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


TypeScript utils.PromiseDelegate.resolve方法代码示例

本文整理汇总了TypeScript中@jupyterlab/services.utils.PromiseDelegate.resolve方法的典型用法代码示例。如果您正苦于以下问题:TypeScript utils.PromiseDelegate.resolve方法的具体用法?TypeScript utils.PromiseDelegate.resolve怎么用?TypeScript utils.PromiseDelegate.resolve使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在@jupyterlab/services.utils.PromiseDelegate的用法示例。


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

示例1: it

      it('should restore the widgets in a tracker', done => {
        let tracker = new InstanceTracker<Widget>({ namespace: 'foo-widget' });
        let registry = new CommandRegistry();
        let state = new StateDB({ namespace: NAMESPACE });
        let ready = new utils.PromiseDelegate<void>();
        let restorer = new InstanceRestorer({
          first: ready.promise, registry, state
        });
        let called = false;
        let key = `${tracker.namespace}:${tracker.namespace}`;

        registry.addCommand(tracker.namespace, {
          execute: () => { called = true; }
        });
        state.save(key, { data: null }).then(() => {
          return restorer.restore(tracker, {
            args: () => null,
            name: () => tracker.namespace,
            command: tracker.namespace
          });
        }).catch(done);
        ready.resolve(void 0);
        restorer.restored.then(() => { expect(called).to.be(true); })
          .then(() => state.remove(key))
          .then(() => { done(); })
          .catch(done);
      });
开发者ID:Carreau,项目名称:jupyterlab,代码行数:27,代码来源:instancerestorer.spec.ts

示例2: it

 it('should add a widget to be tracked by the restorer', done => {
   let ready = new utils.PromiseDelegate<void>();
   let restorer = new LayoutRestorer({
     first: ready.promise,
     registry: new CommandRegistry(),
     state: new StateDB({ namespace: NAMESPACE })
   });
   let currentWidget = new Widget();
   let mode: DockPanel.Mode = 'single-document';
   let dehydrated: ApplicationShell.ILayout = {
     mainArea: { currentWidget, dock: null, mode },
     leftArea: { collapsed: true, currentWidget: null, widgets: null },
     rightArea: { collapsed: true, currentWidget: null, widgets: null }
   };
   restorer.add(currentWidget, 'test-one');
   ready.resolve(void 0);
   restorer.restored.then(() => restorer.save(dehydrated))
     .then(() => restorer.fetch())
     .then(layout => {
       expect(layout.mainArea.currentWidget).to.be(currentWidget);
       expect(layout.mainArea.mode).to.be(mode);
       done();
     }).catch(done);
 });
开发者ID:faricacarroll,项目名称:jupyterlab,代码行数:24,代码来源:layoutrestorer.spec.ts


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