login  Naam:   Wachtwoord: 
Registreer je!
Scripts > JavaScript > Overige > afterLoad


Reacties op het script afterLoad

Offline  Dlol
Gepost op: 01 september 2011 - 12:40
Lid



Waarom gebruik je niet gewoon een callback? Zoiets als in:

  1. function t() {
  2.  
  3. this.method1 = function(callback) {
  4. // Zorg voor wat vertraging
  5. setTimeout(function() {
  6. if (typeof callback == "function") {
  7. callback();
  8. }
  9. }, 3000);
  10. }
  11. this.method2 = function() {
  12. alert("Done with method1!");
  13. }
  14.  
  15. }
  16.  
  17. var obj = new t();
  18. obj.method1(obj.method2);


Enkel aanvullende informatie, vragen en antwoorden op vragen zijn welkom.
 
© 2002-2024 Sitemasters.be - Regels - Laadtijd: 0.019s