本文整理汇总了TypeScript中ember-data/store.findAll函数的典型用法代码示例。如果您正苦于以下问题:TypeScript findAll函数的具体用法?TypeScript findAll怎么用?TypeScript findAll使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了findAll函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
@task(function*(this: MessageDispatcher, msg: Message) {
const everyone = yield this.store.findAll('contact');
everyone.forEach((contact: Contact) => {
this.sendToUser.perform(msg, contact);
});
})
示例2: getRelay
async getRelay(): Promise<Relay> {
const relays: ArrayProxy<Relay> = await this.store.findAll('relay');
const sorted = relays
.toArray()
.filter(r => r.priority !== null && r.priority !== undefined)
.sort(r => r.priority);
const relay = sorted.find(r => r.priority === 1) || sorted[0];
if (!relay) {
this.toast.error('there are no available relays.');
throw new RelayNotSetError();
}
return relay;
}
示例3: makeDefault
async makeDefault(relay: Relay) {
relay.set('priority', 1);
relay.save();
const relays: ArrayProxy<Relay> = await this.store.findAll('relay');
let nextHighestPriority = 2;
relays
.toArray()
.sort(r => r.priority)
.forEach(nonDefaultRelay => {
if (nonDefaultRelay.id === relay.id) return;
nonDefaultRelay.set('priority', nextHighestPriority);
nonDefaultRelay.save();
nextHighestPriority++;
});
}
示例4: allChannels
async allChannels(): Promise<ArrayProxy<Channel>> {
const channels = await this.store.findAll('channel');
return channels;
}
示例5: allContacts
async allContacts(): Promise<ArrayProxy<Contact>> {
const contacts = await this.store.findAll('contact');
return contacts;
}