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


TypeScript rsvp.hash函數代碼示例

本文整理匯總了TypeScript中rsvp.hash函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript hash函數的具體用法?TypeScript hash怎麽用?TypeScript hash使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


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

示例1: hash

 .then((result) => {
   return hash({
     limitedArticleEntries: result.allArticleEntries.slice(0, 2),
     limitedJournalEntries: result.allJournalEntries.slice(0, 2),
     limitedBitEntries: result.allBitEntries.slice(0, 2)
   })
 })
開發者ID:jeffjewiss,項目名稱:jeffjewiss,代碼行數:7,代碼來源:index.ts

示例2: model

  model () {
    let shoebox = this.fastboot.shoebox
    let shoeboxStore = shoebox.retrieve('now')
    let text = this.markdownResolver.file('text', 'now')
    let currentlyListening

    if (this.fastboot.isFastBoot) {
      currentlyListening = this.apollo
        .query({ query })
        .then((result) => {
          if (!shoeboxStore) {
            shoeboxStore = {}
            shoebox.put('now', shoeboxStore)
          }
          shoeboxStore.currentlyListening = result.currentlyListening
          return result.currentlyListening
        })
        .catch(console.error)
    } else {
      currentlyListening = shoeboxStore ? shoeboxStore.currentlyListening : null

      if (!currentlyListening) {
        currentlyListening = this.apollo
          .query({ query })
          .then((result) => result.currentlyListening)
      }
    }

    return hash({
      text,
      currentlyListening
    })
  }
開發者ID:jeffjewiss,項目名稱:jeffjewiss,代碼行數:33,代碼來源:now.ts

示例3: model

  model(params, transition) {
    const store = this.get('store');
    const id = params.housingRequestId;

    const housingRequest = store.findRecord('housing-request', id, {
      include: 'registration,housing_provision'
    });

    return RSVP.hash({ housingRequest });
  }
開發者ID:NullVoxPopuli,項目名稱:aeonvera-ui,代碼行數:10,代碼來源:route.ts

示例4: testHash

function testHash() {
    let promises = {
        myPromise: RSVP.resolve(1),
        yourPromise: RSVP.resolve('2'),
        theirPromise: RSVP.resolve({ key: 3 }),
        notAPromise: 4,
    };
    RSVP.hash(promises, 'my label').then(function(hash) {
        assertType<number>(hash.myPromise);
        assertType<string>(hash.yourPromise);
        assertType<{ key: number }>(hash.theirPromise);
        assertType<number>(hash.notAPromise);
    });
}
開發者ID:Dru89,項目名稱:DefinitelyTyped,代碼行數:14,代碼來源:rsvp-tests.ts

示例5: model

 model () {
   return hash({
     text: this.markdownResolver.file('text', 'bookshelf')
   })
 }
開發者ID:jeffjewiss,項目名稱:jeffjewiss,代碼行數:5,代碼來源:bookshelf.ts

示例6: return

let filterFn = (item: number) => {
    return item > 1;
};
RSVP.filter(promiseArray, filterFn).then(result => {});

RSVP.hashSettled(promiseHash).then(hash => {
    return (
        hash.promiseA.state === 'fulfilled' &&
        hash.promiseB.value === 2 &&
        hash.promiseC.reason === '3' &&
        hash.notAPromise.state === 'fulfilled'
    );
});

RSVP.hash(promiseHash).then(
    values => {
        return (
            values.promiseA < 0 &&
            values.promiseB === 4 &&
            values.promiseC === 12 &&
            values.notAPromise > 0
        );
    },
    err => {}
);

let mapFn = function(item: number) {
    return item + 1;
};
RSVP.map(promiseArray, mapFn).then(function(result) {});
開發者ID:DxCx,項目名稱:DefinitelyTyped,代碼行數:30,代碼來源:rsvp-tests.ts

示例7: model

 model () {
   return hash({
     bio: this.markdownResolver.file('text', 'about/bio'),
     blurb: this.markdownResolver.file('text', 'about/blurb')
   })
 }
開發者ID:jeffjewiss,項目名稱:jeffjewiss,代碼行數:6,代碼來源:about.ts


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