hilary
Version:
a simple Dependency Injection (DI) library that provides Inversion of Control (IoC) capabilities in Node.js and the browser
32 lines (26 loc) • 832 B
JavaScript
(function (register) {
'use strict';
register({
name: 'MyModule',
factory: MyModule
});
function MyModule () {
}
}(function (registration) {
'use strict';
try {
if (typeof module !== 'undefined' && module.exports) {
module.exports = registration.factory;
} else if (typeof window !== 'undefined') {
window.__hilary = window.__hilary || {};
window.__hilary[registration.name] = registration.factory;
} else {
throw new Error('[HILARY] Unkown runtime environment');
}
} catch (e) {
var name = registration && registration.name ? registration.name : 'MISSING NAME';
var err = new Error('[HILARY] Registration failure: ' + name);
err.cause = e;
throw err;
}
}));