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


TypeScript utility.Common類代碼示例

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


在下文中一共展示了Common類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: constructor

 constructor(startAmt, endAmt, startDate, endDate) {
     this.startDate = startDate;
     this.endDate = endDate;
     var dateDiff = Common.dateDiff(Common.parseDate(this.startDate), Common.parseDate(this.endDate), 365);
     
     this.return = endAmt / startAmt;
     this.cagr = parseFloat(((Math.pow(this.return, 1 / dateDiff) - 1) * 100).toFixed(2));
     this.return = parseFloat(((this.return - 1) * 100).toFixed(2));
 }
開發者ID:urazovm,項目名稱:backlive2.0,代碼行數:9,代碼來源:strategy.model.ts

示例2: setTimeout

 notify<T>(eventName: string, data: T = null) {
     if (this.Events[eventName]) {
         setTimeout(() => {
             var cnt = 0;
             
             //notify any services first
             if(this.Events[eventName][this.ServiceComponentId]) {
                 this.notifyComponent<T>(this.ServiceComponentId, eventName, data);
             }
             
             for(var componentId in this.Events[eventName]) {
                 if(componentId != this.ServiceComponentId) {
                     this.notifyComponent<T>(componentId, eventName, data);
                 }
                 
                 cnt++;
             }
             
             if(cnt == 0) {
                 Common.log('EVENT: ' + eventName + ' has no subscribers');
             }
             else {
                 //Common.log('EVENT: ' + eventName + ' fired to ' + cnt + ' subscribers with data', data);
             }
         });
     }
     else {
         Common.log('EVENT: ' + eventName + ' has no subscribers');
     }
 }
開發者ID:urazovm,項目名稱:backlive2.0,代碼行數:30,代碼來源:app.service.ts

示例3: callback

 notify<T>(eventName: string, data: T = null) {
     if (this.Events[eventName]) {
         //Common.log('EVENT: ' + eventName + ' fired to ' + this.Events[eventName].length + ' subscribers with data', data);
         for(var classType in this.Events[eventName]) {
             this.Events[eventName][classType].forEach((callback: Function) => {
                 callback(data);
             });
         }
     }
     else {
         Common.log('EVENT: ' + eventName + ' has no subscribers');
     }
 }
開發者ID:alincc,項目名稱:backlive2.0,代碼行數:13,代碼來源:app.service.ts

示例4: subscribe

 subscribe(eventName: string, classInstance: any, callback: Function) {
     var classType = classInstance.constructor.name;
     
     if(classType) {
         if (!this.Events[eventName]) {
             this.Events[eventName] = {};
         }
         
         if(!this.Events[eventName][classType]) {
             this.Events[eventName][classType] = [];
         }
 
         this.Events[eventName][classType].push(callback);
     }
     else {
         Common.log('Constructor Name not supported: ' + eventName + ' could not be subscribed to');
     }
 }
開發者ID:alincc,項目名稱:backlive2.0,代碼行數:18,代碼來源:app.service.ts

示例5: processError

 private processError(err: Response) {
     if(err) {
         Common.log(err);
         var res = err.json();
         
         if(this.apiService.getToken() && res.message && res.message.indexOf('Authorization has been denied') >= 0) {
             this.apiService.setToken(null);
             this.appService.notify(AppEvent.ReloadApp);
         }
         else {
             if (Config.SHOW_ERRORS) {
                 this.appService.notify(AppEvent.OpenModal, { title: "API Request Error", body: JSON.stringify(res) });
             }
             else {
                 this.appService.notify(AppEvent.MessageBar, 'an unexpected error occurred');
             }
         }
     }
 }
開發者ID:urazovm,項目名稱:backlive2.0,代碼行數:19,代碼來源:base.service.ts


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