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


TypeScript ionic.SqlStorage類代碼示例

本文整理匯總了TypeScript中ionic-framework/ionic.SqlStorage的典型用法代碼示例。如果您正苦於以下問題:TypeScript SqlStorage類的具體用法?TypeScript SqlStorage怎麽用?TypeScript SqlStorage使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了SqlStorage類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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:Fredqin,項目名稱:personal_task_runner,代碼行數: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:Fredqin,項目名稱:personal_task_runner,代碼行數:15,代碼來源:clickers.ts

示例3: newTask

    public newTask(name: string): string {
        const id: string = this.uid();
        // by default time is set to 300
        const task: Task = new Task(id, name, 300);
        // add the task to the service
        this.tasks.push(task);
        // 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(task));
        // save the service's ids array
        this.storage.set('ids', JSON.stringify(this.ids));

        return id;
    }
開發者ID:Fredqin,項目名稱:personal_task_runner,代碼行數:15,代碼來源:tasks.ts

示例4: 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:Fredqin,項目名稱:personal_task_runner,代碼行數:9,代碼來源:clickers.ts

示例5: Promise

 return new Promise((resolve: Function) => {
     let tasks: Array<Task> = [];
     for (let id of ids) {
         this.storage.get(id)
             .then((task: string) => {
                 tasks.push(this.initTask(task));
             });
     }
     resolve(tasks);
 });
開發者ID:Fredqin,項目名稱:personal_task_runner,代碼行數:10,代碼來源:tasks.ts

示例6: 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:Fredqin,項目名稱:personal_task_runner,代碼行數:6,代碼來源:clickers.ts


注:本文中的ionic-framework/ionic.SqlStorage類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。