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


TypeScript ionic-angular.SqlStorage類代碼示例

本文整理匯總了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;未經允許,請勿轉載。