• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript ionic-cache.CacheService类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中ionic-cache.CacheService的典型用法代码示例。如果您正苦于以下问题:TypeScript CacheService类的具体用法?TypeScript CacheService怎么用?TypeScript CacheService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了CacheService类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: getAppointments

  public getAppointments(config:IModuleConfig, token, forceReload?): Observable<AppointConfig> {

    var url = config.moodleServiceEndpoint;
    var courseID = config.courseID;
    var accessToken = config.authorization.credentials.authHeader.accessToken;


    var today = new Date();
    var oneYearLater = new Date();
    oneYearLater.setFullYear(today.getFullYear()+1);

    let params:HttpParams = new HttpParams()
      .append("wstoken",                token)
      .append("wsfunction",             "local_reflect_get_calendar_entries")
      .append("moodlewsrestformat",     "json")
      .append("options[userevents]",    "0")
      .append("options[siteevents]",    "0")
      .append("options[timestart]",      Math.floor(today.getTime() / 1000).toString())
      .append("options[timeend]",        Math.floor(oneYearLater.getTime() / 1000).toString())
      .append("options[ignorehidden]",   "1")
      .append("courseID",                courseID);

    let headers:HttpHeaders = new HttpHeaders()
      .append("Authorization", accessToken);

    let request = this.http.get<AppointConfig>(url, {headers:headers,params:params});

    if (forceReload) { this.cache.removeItem("cachedEvents"); }

    return this.cache.loadFromObservable("cachedEvents", request);

  }
开发者ID:University-of-Potsdam-MM,项目名称:ReflectUP,代码行数:32,代码来源:event-provider.ts


示例2:

 this.platform.ready().then(() => {
   this.cache.setDefaultTTL(60 * 60 * 2);     // 2h caching
   this.cache.setOfflineInvalidate(false);     // keep cached results when device is offline
   if (this.platform.is("cordova")) {
     this.splashScreen.hide();
     this.statusBar.styleDefault();
     this.storage.get("hiddenCards").then(array => {
       if (array == undefined) {
         this.storage.set("hiddenCards", ["-1"]);
       }
     });
     this.storage.get("scheduledEvents").then(array => {
       if (array == undefined) {
         this.storage.set("scheduledEvents", ["-1"]);
       }
     });
   }
 });
开发者ID:University-of-Potsdam-MM,项目名称:ReflectUP,代码行数:18,代码来源:app.component.ts


示例3: getAnsweredQuestions

  public getAnsweredQuestions(config:IModuleConfig, token, forceReload?): Observable<QuestionConfig> {

    var url = config.moodleServiceEndpoint;
    var courseID = config.courseID;
    var accessToken = config.authorization.credentials.authHeader.accessToken;

    let params:HttpParams = new HttpParams()
      .append("wstoken",              token)
      .append("wsfunction",           "local_reflect_get_completed_feedbacks")
      .append("moodlewsrestformat",   "json")
      .append("courseID",             courseID);

    let headers:HttpHeaders = new HttpHeaders()
      .append("Authorization", accessToken);

    let request = this.http.get<QuestionConfig>(url, {headers:headers,params:params});

    if (forceReload) { this.cache.removeItem("cachedCompletedQuestions"); }

    return this.cache.loadFromObservable("cachedCompletedQuestions", request);
  }
开发者ID:University-of-Potsdam-MM,项目名称:ReflectUP,代码行数:21,代码来源:question-provider.ts


示例4: performLogout

  /**
   * performLogout
   *
   * unsets current session, thus logging the user out
   */
  performLogout() {
    if (this.platform.is("cordova")) {
      if (this.config) {
        this.pushProv.unsubscribeToPush(this.config);
        this.storage.set("config", null);
      }
    } else { this.storage.set("config", null); }

    this.cache.clearAll();
    this.storage.set("session", null);
    this.storage.set("pushRegistered", false);
    this.navCtrl.setRoot(SelectModulePage);
  }
开发者ID:University-of-Potsdam-MM,项目名称:ReflectUP,代码行数:18,代码来源:logout.ts



注:本文中的ionic-cache.CacheService类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript ionic.Alert类代码示例发布时间:2022-05-25
下一篇:
TypeScript util.isPresent函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap