本文整理匯總了TypeScript中ionic-angular/index.SqlStorage.set方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript SqlStorage.set方法的具體用法?TypeScript SqlStorage.set怎麽用?TypeScript SqlStorage.set使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ionic-angular/index.SqlStorage
的用法示例。
在下文中一共展示了SqlStorage.set方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: 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;
}
示例2: 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));
}
示例3: 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));
}