本文整理汇总了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;未经允许,请勿转载。 |
请发表评论