本文整理汇总了TypeScript中ionic-angular/index.SqlStorage类的典型用法代码示例。如果您正苦于以下问题:TypeScript SqlStorage类的具体用法?TypeScript SqlStorage怎么用?TypeScript SqlStorage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SqlStorage类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: removeClicker
public removeClicker(id: string): void {
// remove clicker from the service
this.clickers = this.clickers.filter((clicker: Clicker) => { return clicker.getId() !== id; });
// remove from ids array
this.ids = this.ids.filter((filterId: string) => { return filterId !== id; });
// null id in db
this.storage.remove(id);
// update service's ids array
this.storage.set('ids', JSON.stringify(this.ids));
}
开发者ID:udayakanth1122,项目名称:ionic2-karma-jasmine-travis-seed,代码行数:14,代码来源:clickers.ts
示例2: newClicker
public newClicker(name: string): string {
const id: string = this.uid();
const clicker: Clicker = new Clicker(id, name);
// add the clicker to the service
this.clickers.push(clicker);
// add the id to the service (need to keep a separate reference of IDs so we can cold load clickers)
this.ids.push(id);
// save the clicker by id
this.storage.set(id, JSON.stringify(clicker));
// save the service's ids array
this.storage.set('ids', JSON.stringify(this.ids));
return id;
}
开发者ID:udayakanth1122,项目名称:ionic2-karma-jasmine-travis-seed,代码行数:15,代码来源:clickers.ts
示例3: Promise
return new Promise((resolve: Function) => {
let ids: Array<string> = [];
this.storage.get('ids') // return the promise so we can chain initClickers
.then((rawIds: string) => {
// ids are stored as stringified JSON array
ids = JSON.parse(rawIds) || [];
})
.then(() => resolve(ids));
});
开发者ID:udayakanth1122,项目名称:ionic2-karma-jasmine-travis-seed,代码行数:9,代码来源:clickers.ts
示例4: doClick
public doClick(id: string): void {
const clicker: Clicker = this.getClicker(id);
clicker.doClick();
// save the clicker with updated click in storage
this.storage.set(clicker.getId(), JSON.stringify(clicker));
}
开发者ID:udayakanth1122,项目名称:ionic2-karma-jasmine-travis-seed,代码行数:6,代码来源:clickers.ts
注:本文中的ionic-angular/index.SqlStorage类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论