Last active
December 14, 2015 02:19
-
-
Save sukima/5013173 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($) { | |
var myTest; | |
function Test() { | |
$(Test).trigger("init.test"); | |
} | |
Test.prototype.ready = function() { | |
$(this).trigger("ready.test"); | |
}; | |
$(Test).on("init", function() { console.log("Test init'ed"); }); | |
myTest = new Test(); | |
$(myTest).on("ready", function() { console.log("Test ready'ed"); }); | |
myTest.ready(); | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This causes an infinate loop because when you call
$(Test)
it seesTest
as a function and adds it to the document.ready event which is triggered and executed over and over and over and over and...