How to use where clause in Knex
Create refunds with Stripe
Load HTML with Cheerio
How to send POST request with Axios
Find intersection of array in Lodash
Powered by Official white Bloop logo with a period

Terms / Privacy / Search / Support

  • const storeData = async (value) => {
      try {
        await AsyncStorage.setItem('@storage_Key', value)
      } catch (e) {
        // saving error
      }
    }
    Docs
  • 
    // create new (global) storage instance
    const storage = new AsyncLocalStorage<EntityManager>();
    
    @Module({
      imports: [
        MikroOrmModule.forRoot({
          // ...
          registerRequestContext: false, // disable automatatic middleware
          context: () => storage.getStore(), // use our AsyncLocalStorage instance
        }),
      ],
      controllers: [AppController],
      providers: [AppService],
    })
    export class AppModule {}
    
    // register the request context middleware
    const app = await NestFactory.create(AppModule, { ... });
    const orm = app.get(MikroORM);
    
    app.use((req, res, next) => {
      storage.run(orm.em.fork(true, true), next);
    });
    
    Docs
  • const store = { id: 1 };
    // Replaces previous store with the given store object
    asyncLocalStorage.enterWith(store);
    asyncLocalStorage.getStore(); // Returns the store object
    someAsyncOperation(() => {
      asyncLocalStorage.getStore(); // Returns the same object
    });
    Docs
  • window.addEventListener('storage', () => {
      // When local storage changes, dump the list to
      // the console.
      console.log(JSON.parse(window.localStorage.getItem('sampleList')));
    });
    
    Docs
  • window.onstorage = () => {
      // When local storage changes, dump the list to
      // the console.
      console.log(JSON.parse(window.localStorage.getItem('sampleList')));
    };
    
    Docs
  • Powered by Official black Bloop logo with a period
    download the IDE extension

    View other examples