Created
March 25, 2013 08:54
-
-
Save a-ignatov-parc/5235795 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| asyncTest('Context works normaly between to instances of one class', 1, function() { | |
| var observatory = new window.WebApp.Observatory(), | |
| TestClass = function() { | |
| var count = this.count, | |
| cid; | |
| this.cid = cid = 'c' + count; | |
| this.constructor.prototype.count++ | |
| this.init = function() { | |
| observatory.on('test.' + this.cid, this.handler, this); | |
| }; | |
| this.destroy = function() { | |
| observatory.off('.' + this.cid); | |
| }; | |
| this.init(); | |
| }; | |
| TestClass.prototype = { | |
| constructor: TestClass, | |
| handler: function() { | |
| equal(this.cid, 'c0', 'context is ok'); | |
| }, | |
| count: 0 | |
| }; | |
| var a = new TestClass(), | |
| b = new TestClass(); | |
| b.destroy(); | |
| b = null; | |
| start(); | |
| observatory.trigger('test'); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment