本文整理汇总了TypeScript中backlive/utility.Common.log方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Common.log方法的具体用法?TypeScript Common.log怎么用?TypeScript Common.log使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类backlive/utility.Common
的用法示例。
在下文中一共展示了Common.log方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: 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');
}
}
示例2: 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');
}
}
示例3: 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');
}
}
示例4: 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');
}
}
}
}