@tmorin/ceb-messaging-builder-inversion
Version:
The package is part of the `<ceb/>` library. It provides a builder to resolve and inject a bus from a container and then subscribe to event.
44 lines • 1.91 kB
JavaScript
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
import { ContainerSymbol } from "@tmorin/ceb-inversion-core";
import { GatewayInversionBuilder } from "./builder";
/**
* The module can set the default container of {@link GatewayInversionBuilder}.
*
* @example Register the module
* ```typescript
* import {ContainerBuilder} from "@tmorin/ceb-inversion-core"
* import {GatewayInversionBuilderModule} from "@tmorin/ceb-messaging-builder-inversion"
* const container = ContainerBuilder.get()
* .module(new GatewayInversionBuilderModule())
* .build()
* ```
*/
export class GatewayInversionBuilderModule {
constructor(
/**
* Options of the module.
*/
partialOptions = {}) {
this.options = Object.assign({ setDefaultContainer: true }, partialOptions);
}
initialize(configuration) {
return __awaiter(this, void 0, void 0, function* () {
if (this.options.setDefaultContainer) {
GatewayInversionBuilder.setDefaultContainer(configuration.registry.resolve(ContainerSymbol));
}
});
}
// eslint-disable-next-line @typescript-eslint/no-empty-function
dispose() {
return __awaiter(this, void 0, void 0, function* () { });
}
}
//# sourceMappingURL=module.js.map