本文整理汇总了TypeScript中ionic-angular.SqlStorage类的典型用法代码示例。如果您正苦于以下问题:TypeScript SqlStorage类的具体用法?TypeScript SqlStorage怎么用?TypeScript SqlStorage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SqlStorage类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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:jamesgroat,项目名称:clicker,代码行数: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:jamesgroat,项目名称:clicker,代码行数: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:BilelKrichen,项目名称:clicker,代码行数:9,代码来源:clickers.ts
示例4: Promise
return new Promise((resolve: Function) => {
let clickers: Array<Clicker> = [];
for (let id of ids) {
this.storage.get(id)
.then((clicker: string) => {
clickers.push(this.initClicker(clicker));
});
}
resolve(clickers);
});
开发者ID:jamesgroat,项目名称:clicker,代码行数:10,代码来源:clickers.ts
示例5: 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:jamesgroat,项目名称:clicker,代码行数:6,代码来源:clickers.ts
示例6: remove
public remove(key: string): Promise<{}> {
return this.storage.remove(key);
}
开发者ID:CheckHealthCo,项目名称:clicker,代码行数:3,代码来源:storage.ts
示例7: set
public set(key: string, value: string): Promise<{}> {
return this.storage.set(key, value);
}
开发者ID:CheckHealthCo,项目名称:clicker,代码行数:3,代码来源:storage.ts
示例8: get
public get(key: string): Promise<{}> {
return this.storage.get(key);
}
开发者ID:CheckHealthCo,项目名称:clicker,代码行数:3,代码来源:storage.ts
注:本文中的ionic-angular.SqlStorage类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论