You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
poseidonCore edited this page May 7, 2016
·
5 revisions
######NODE.JS VS NODALREQUIRE
When a Node.js module is initialised, it is bound with this = module.exports. This is the same for NodalRequire. Hence, the following yield the same result:
console.log(this == exports); // >> true
You can redefine module.exports (to create a function module, class, etc) in the same way in both of them.
However, the following code sometimes yields different results for NodalRequire depending on the way that the browser has implemented the closure:
function whatIsThis () {
console.log(this);
}
whatIsThis(); // >> should be 'undefined' but sometimes '[object Object]'
I am still investigating whether this is incidental or consistent.