How to use the typedi.set function in typedi

To help you get started, we’ve selected a few typedi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github MichalLytek / type-graphql / examples / using-scoped-container / recipe / recipe.samples.ts View on Github external
export function setSamplesInContainer() {
  // add sample recipes to container
  Container.set({
    id: "SAMPLE_RECIPES",
    transient: true, // create a fresh copy for each `get` of samples
    factory: () => {
      console.log("sampleRecipes copy created!");
      return sampleRecipes.slice();
    },
  });
}
github webclipper / web-clipper / src / pages / app.tsx View on Github external
(async () => {
  initGa();
  await syncStorageService.init();
  await localStorageService.init();
  await localeService.init();
  Container.set(ILocalStorageService, localStorageService);
  Container.set(ISyncStorageService, syncStorageService);
  Container.get(IConfigService).load();
  Container.get(IPowerpackService).startup();
  const app = dva({
    namespacePrefixWarning: false,
    history: createHashHistory(),
    onError: e => {
      (e as any).preventDefault();
      message.destroy();
      message.error(e.message);
    },
  });
  app.use(createLoading());
  if (config.createLogger) {
    app.use(
      createLogger({
        predicate: (_: Function, { type }: Action) => {
github webclipper / web-clipper / src / pages / app.tsx View on Github external
(async () => {
  initGa();
  await syncStorageService.init();
  await localStorageService.init();
  await localeService.init();
  Container.set(ILocalStorageService, localStorageService);
  Container.set(ISyncStorageService, syncStorageService);
  Container.get(IConfigService).load();
  Container.get(IPowerpackService).startup();
  const app = dva({
    namespacePrefixWarning: false,
    history: createHashHistory(),
    onError: e => {
      (e as any).preventDefault();
      message.destroy();
      message.error(e.message);
    },
  });
  app.use(createLoading());
  if (config.createLogger) {
    app.use(
      createLogger({