Created
June 6, 2011 15:48
-
-
Save jfsiii/1010501 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(){ | |
function Klass(id){ this._id = id; } | |
Klass.prototype.id = function(){ console.log(this._id); } | |
var freeExports = typeof exports == 'object' && exports; | |
if (freeExports) { | |
for (var prop in Klass) freeExports[prop] = Klass[prop]; | |
} else if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) { | |
define(function() { return Klass; }); | |
} else { | |
// use square bracket notation so Closure Compiler won't mung `Klass` | |
// http://code.google.com/closure/compiler/docs/api-tutorial3.html#export | |
window['Klass'] = Klass; | |
} | |
})(); |
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
> var Klass = require('./js/boilerplate.js') | |
> var foo = new Klass('foo') | |
TypeError: object is not a function | |
at Object.CALL_NON_FUNCTION_AS_CONSTRUCTOR (native) | |
at [object Context]:1:11 | |
at Interface.<anonymous> (repl.js:171:22) | |
at Interface.emit (events.js:64:17) | |
at Interface._onLine (readline.js:153:10) | |
at Interface._line (readline.js:408:8) | |
at Interface._ttyWrite (readline.js:585:14) | |
at ReadStream.<anonymous> (readline.js:73:12) | |
at ReadStream.emit (events.js:81:20) | |
at ReadStream._emitKey (tty_posix.js:307:10) | |
> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment