当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript runloop.run函数代码示例

本文整理汇总了TypeScript中@ember/runloop.run函数的典型用法代码示例。如果您正苦于以下问题:TypeScript run函数的具体用法?TypeScript run怎么用?TypeScript run使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了run函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: run

 snapshot.docChanges().forEach(change => run(() => {
     const normalizedData = firestoreNormalize(store, modelClass, change.doc);
     switch(change.type) {
         case 'added': {
             const current = model.content.objectAt(change.newIndex);
             if (current == null || current.id !== change.doc.id ) {
                 const doc = store.push(normalizedData) as any;
                 model.content.insertAt(change.newIndex, doc._internalModel);
             }
             break;
         }
         case 'modified': {
             const current = model.content.objectAt(change.oldIndex);
             if (current == null || current.id == change.doc.id) {
                 if (change.newIndex !== change.oldIndex) {
                     model.content.removeAt(change.oldIndex);
                     model.content.insertAt(change.newIndex, current)
                 }
             }
             store.push(normalizedData);
             break;
         }
         case 'removed': {
             const current = model.content.objectAt(change.oldIndex);
             if (current && current.id == change.doc.id) {
                 model.content.removeAt(change.oldIndex);
             }
             break;
         }
     }
 }))
开发者ID:firebase,项目名称:emberfire,代码行数:31,代码来源:realtime-listener.ts

示例2: run

 const unsubscribe = auth.onIdTokenChanged(currentUser => run(() => {
     unsubscribe();
     if (currentUser) {
         resolve({currentUser});
     } else {
         reject();
     }
 }))
开发者ID:firebase,项目名称:emberfire,代码行数:8,代码来源:firebase.ts

示例3: findOrCreate

 async findOrCreate(id: string, name: string): Promise<Channel> {
   return await run(async () => {
     try {
       return await this.findAndSetName(id, name);
     } catch (e) {
       return await this.create(id, name);
     }
   });
 }
开发者ID:NullVoxPopuli,项目名称:emberclear,代码行数:9,代码来源:channel-manager.ts

示例4: findOrCreate

 async findOrCreate(uid: string, name: string): Promise<Contact> {
   return await run(async () => {
     try {
       // an exception thrown here is never caught
       return await this.findAndSetName(uid, name);
     } catch (e) {
       return await this.create(uid, name);
     }
   });
 }
开发者ID:NullVoxPopuli,项目名称:emberclear,代码行数:10,代码来源:contact-manager.ts

示例5: startApp

export default function startApp(attrs?: any): App {
  let attributes = merge({}, config.APP);
  attributes.autoboot = true;
  attributes = merge(attributes, attrs); // use defaults, but you can override;

  return run(() => {
    let application = App.create(attributes);
    application.setupForTesting();
    application.injectTestHelpers();
    return application as App;
  });
}
开发者ID:salsify,项目名称:ember-debug-logger,代码行数:12,代码来源:start-app.ts

示例6: testRun

function testRun() {
    run(() => { // $ExpectType number
        // code to be executed within a RunLoop
        return 123;
    });

    function destroyApp(application: EmberObject) {
        run(application, 'destroy');
        run(application, function() {
            this.destroy();
        });
    }
}
开发者ID:AlexGalays,项目名称:DefinitelyTyped,代码行数:13,代码来源:ember__runloop-tests.ts

示例7: testRun

function testRun() {
    let r = run(function() {
        // code to be executed within a RunLoop
        return 123;
    });
    assertType<number>(r);

    function destroyApp(application: Ember.Application) {
        Ember.run(application, 'destroy');
        run(application, function() {
            this.destroy();
        });
    }
}
开发者ID:AbraaoAlves,项目名称:DefinitelyTyped,代码行数:14,代码来源:run.ts


注:本文中的@ember/runloop.run函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。