Skip to content

Instantly share code, notes, and snippets.

@ralt
Created July 13, 2012 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save ralt/3105113 to your computer and use it in GitHub Desktop.
Save ralt/3105113 to your computer and use it in GitHub Desktop.
Trying to understand ncore...
var ncore = require( 'ncore' );
ncore.constructor( {
"./other.js": {
"test": "./test.js"
}
});
console.log( ncore );
ncore.add( 'test', require( './test.js' ) );
ncore.add( 'other', require( './other.js' ) );
console.log( ncore );
ncore.init();
{ [Function: NCore]
constructor: [Function],
add: [Function],
init: [Function],
proxies: {},
_modules: {},
_interfaces: {},
dependencies: { './other.js': { test: './test.js' } } }
{ [Function: NCore]
constructor: [Function],
add: [Function],
init: [Function],
proxies:
{ test:
{ once: [Function],
constructor: [Function],
emit: [Function],
removeListener: [Function],
setMaxListeners: [Function],
on: [Function],
removeAllListeners: [Function],
listeners: [Function],
addListener: [Function],
sayHi: [Function: proxy],
init: [Function: proxy] },
other:
{ once: [Function],
constructor: [Function],
emit: [Function],
removeListener: [Function],
setMaxListeners: [Function],
on: [Function],
removeAllListeners: [Function],
listeners: [Function],
addListener: [Function],
init: [Function: proxy] } },
_modules:
{ test: { init: [Function], sayHi: [Function], emit: [Function] },
other: { init: [Function], emit: [Function] } },
_interfaces:
{ test: { sayHi: [Function], init: [Function] },
other: { init: [Function] } },
dependencies: { './other.js': { test: './test.js' } } }
hi
module.exports = {
init: function() {
this.test.sayHi();
}
};
module.exports = {
init: function() {
console.log( 'hi' );
},
sayHi: function() {
console.log( 'Lol I said hi!' );
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment