@robotlegsjs/core
Version:
An architecture-based IoC framework for JavaScript/TypeScript
28 lines • 1.34 kB
JavaScript
;
// ------------------------------------------------------------------------------
// Copyright (c) 2017-present, RobotlegsJS. All Rights Reserved.
//
// NOTICE: You are permitted to use, modify, and distribute this file
// in accordance with the terms of the license agreement accompanying it.
// ------------------------------------------------------------------------------
Object.defineProperty(exports, "__esModule", { value: true });
exports.instantiateUnmapped = void 0;
/*============================================================================*/
/* Public Functions */
/*============================================================================*/
/**
* Instantiate a object inside the context of the injector without keeping it for future requests.
* All injections of the object will be provided by the injector, but the injector will not keep
* a reference of the object for future requests.
*
* @param injector An injector
* @param type A object that must be instantiated
*/
function instantiateUnmapped(injector, type) {
injector.bind(type).to(type);
var instance = injector.get(type);
injector.unbind(type);
return instance;
}
exports.instantiateUnmapped = instantiateUnmapped;
//# sourceMappingURL=instantiateUnmapped.js.map