Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
socketServer: ['factory', createSocketIoServer],
executor: ['type', Executor],
// TODO(vojta): remove
customFileHandlers: ['value', []],
// TODO(vojta): remove, once karma-dart does not rely on it
customScriptTypes: ['value', []],
reporter: ['factory', reporter.createReporters],
capturedBrowsers: ['type', BrowserCollection],
args: ['value', {}],
timer: ['value', {setTimeout: setTimeout, clearTimeout: clearTimeout}]
}];
// load the plugins
modules = modules.concat(plugin.resolve(config.plugins));
var injector = new di.Injector(modules);
injector.invoke(start);
};
// add all _resources to list for DI
resources = this._resources.getAllInstances();
for (rKey in resources) {
module[rKey] = ['value', resources[rKey]];
}
// add all service.resources to list for DI
if (service) {
resources = service.resources.getAllInstances();
for (rKey in resources) {
module[rKey] = ['value', resources[rKey]];
}
}
// creates injector
var injector = (new di.Injector([module]));
// run function
if (func) {
if (parent) {
return injector.invoke(func, parent);
}
else {
return injector.invoke(func);
}
}
else {
if (parent) {
if (parent.module.toString().indexOf('function') === 0) {
var InjectedWrapper = function () {
return injector.invoke(parent.module, this);
};
socketServer: ['factory', createSocketIoServer],
executor: ['type', Executor],
// TODO(vojta): remove
customFileHandlers: ['value', []],
// TODO(vojta): remove, once karma-dart does not rely on it
customScriptTypes: ['value', []],
reporter: ['factory', reporter.createReporters],
capturedBrowsers: ['type', BrowserCollection],
args: ['value', {}],
timer: ['value', {setTimeout: setTimeout, clearTimeout: clearTimeout}]
}];
// load the plugins
modules = modules.concat(plugin.resolve(config.plugins));
var injector = new di.Injector(modules);
injector.invoke(start);
};
// Copyright 2015, EMC, Inc.
"use strict";
var di = require('di'),
_ = require('lodash'),
core = require('on-core')(di),
injector = new di.Injector(
_.flatten([
core.injectables,
core.helper.requireGlob(__dirname + '/lib/**/*.js')
])
),
core = injector.get('Services.Core'),
configuration = injector.get('Services.Configuration'),
Logger = injector.get('Logger'),
logger = Logger.initialize('Dhcp'),
Server = injector.get('DHCP.Proxy.Server');
core.start()
.then(function() {
Server.create(
configuration.get('dhcpProxyBindPort', 4011),
{
it('should remove the watchGroup', ()=>{
var root = new RootView($('<div></div>')[0], new Injector());
spyOn(root.watchGrp, 'remove').and.callThrough();
root.destroy();
expect(root.watchGrp.remove).not.toHaveBeenCalled();
var childView = new View(root, $('<div></div>')[0], new Injector());
spyOn(childView.watchGrp, 'remove').and.callThrough();
childView.destroy();
expect(childView.watchGrp.remove).toHaveBeenCalled();
});
it('should create a child injector and provide the view on the new injector', ()=>{
var injector = new Injector();
var execContext = {};
var view = new ViewFactory($('<div>a</div>')[0], []).createRootView(injector, execContext);
expect(view.injector.parent).toBe(injector);
expect(view.injector.get(View)).toBe(view);
});
beforeEach(() => {
$rootElement = $(anchorHtml);
anchor = $rootElement[0];
viewPort = new ViewPort(anchor);
a = new RootView($('<div>'+aHtml+'</div>')[0], new Injector());
b = new RootView($('<div>'+bHtml+'</div>')[0], new Injector());
c = new RootView($('<div>'+cHtml+'</div>')[0], new Injector());
d = new RootView($('<div>'+dHtml+'</div>')[0], new Injector());
});
var di = require('di');
var Car = require('./car');
var injector = new di.Injector([]);
console.log('Getting in the car...');
var car = injector.get(Car);
car.run();
if (car.isRunning()) {
console.log('The car is running');
} else {
console.log('The car is stopped');
}
function createChildInjector(baseInjector, docs) {
var module = new di.Module();
module.factory('injector', function() { return baseInjector; });
if ( docs ) { module.value('docs', docs); }
return new di.Injector([module], baseInjector);
}
export function run(config: Util.Config, outputFile: string) {
Globals.Configure({ outputFile: outputFile });
var di = require('di');
new di.Injector([{
emitter: ['type', require('karma/lib/events').EventEmitter],
config: ['value', Util.getKarmaConfig(config)],
preprocess: ['factory', require('karma/lib/preprocessor').createPreprocessor],
fileList: ['type', require('karma/lib/file_list').List]
}]).invoke(discoverTests);
}