Created
January 14, 2017 13:48
-
-
Save kevjose/25bec07393aec6f89e00afc24dc12d15 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
| function MyConstructor(data, transport) { | |
| this.data = data; | |
| transport.on('data', function () { | |
| alert(this.data); | |
| }); | |
| } | |
| // Mock transport object | |
| var transport = { | |
| on: function(event, callback) { | |
| setTimeout(callback, 1000); | |
| } | |
| }; | |
| // called as | |
| var obj = new MyConstructor('foo', transport); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment