當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript PromiseDelegate.reject方法代碼示例

本文整理匯總了TypeScript中@phosphor/coreutils.PromiseDelegate.reject方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript PromiseDelegate.reject方法的具體用法?TypeScript PromiseDelegate.reject怎麽用?TypeScript PromiseDelegate.reject使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在@phosphor/coreutils.PromiseDelegate的用法示例。


在下文中一共展示了PromiseDelegate.reject方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: it

 it('should reject the underlying promise', done => {
   let delegate = new PromiseDelegate<number>();
   delegate.promise.catch(reason => {
     expect(reason).to.equal('foo');
     done();
   });
   delegate.reject('foo');
 });
開發者ID:afshin,項目名稱:phosphor,代碼行數:8,代碼來源:promise.spec.ts

示例2: expect

 tester.onMessage(msg => {
   try {
     expect(msg.header.msg_id).to.be(msgId);
   } catch (e) {
     done.reject(e);
     throw e;
   }
   done.resolve(null);
 });
開發者ID:groutr,項目名稱:jupyterlab,代碼行數:9,代碼來源:ikernel.spec.ts

示例3: TextDecoder

 tester.onMessage(msg => {
   try {
     let decoder = new TextDecoder('utf8');
     let item = msg.buffers[0] as DataView;
     expect(decoder.decode(item)).to.be('hello');
   } catch (e) {
     done.reject(e);
     throw e;
   }
   done.resolve(null);
 });
開發者ID:groutr,項目名稱:jupyterlab,代碼行數:11,代碼來源:ikernel.spec.ts

示例4: catch

        debouncer = window.setTimeout(async () => {
          const data = await db.toJSON();

          try {
            await workspaces.save(id, { data, metadata });
            if (conflated) {
              conflated.resolve(undefined);
            }
          } catch (error) {
            if (conflated) {
              conflated.reject(error);
            }
          }
          conflated = null;
        }, timeout);
開發者ID:jupyter,項目名稱:jupyterlab,代碼行數:15,代碼來源:index.ts

示例5: catch

        debouncer = window.setTimeout(async () => {
          // Prevent a race condition between the timeout and saving.
          if (!conflated) {
            return;
          }

          const data = await state.toJSON();

          try {
            await workspaces.save(id, { data, metadata });
            conflated.resolve(undefined);
          } catch (error) {
            conflated.reject(error);
          }
          conflated = null;
        }, timeout);
開發者ID:willingc,項目名稱:jupyterlab,代碼行數:16,代碼來源:index.ts

示例6: it

 it('should resolve to true even if the promise is rejected', async () => {
   const p = new PromiseDelegate<number>();
   expect(await isFulfilled(p.promise)).to.equal(false);
   p.reject(new Error('my error'));
   expect(await isFulfilled(p.promise)).to.equal(true);
 });
開發者ID:AlbertHilb,項目名稱:jupyterlab,代碼行數:6,代碼來源:utils.spec.ts

示例7:

 .catch(reason => {
   conflated.reject(reason);
   conflated = null;
 });
開發者ID:dalejung,項目名稱:jupyterlab,代碼行數:4,代碼來源:index.ts


注:本文中的@phosphor/coreutils.PromiseDelegate.reject方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。