本文整理汇总了TypeScript中@providers/utils/utils.CoreUtilsProvider类的典型用法代码示例。如果您正苦于以下问题:TypeScript CoreUtilsProvider类的具体用法?TypeScript CoreUtilsProvider怎么用?TypeScript CoreUtilsProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CoreUtilsProvider类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: constructor
constructor(private translate: TranslateService, element: ElementRef, private eventsProvider: CoreEventsProvider,
utils: CoreUtilsProvider) {
this.element = element.nativeElement;
// Calculate the unique ID.
this.uniqueId = 'core-loading-content-' + utils.getUniqueId('CoreLoadingComponent');
}
示例2: notificationClicked
pushNotificationsDelegate.on('click').subscribe((notification) => {
if (utils.isFalseOrZero(notification.notif)) {
notificationClicked(notification);
return true;
}
});
示例3:
return this.coursesProvider.getCoursesByField('ids', courseIds).then((coursesInfo) => {
coursesInfo = this.utils.arrayToObject(coursesInfo, 'id');
courses.forEach((course) => {
this.loadCourseExtraInfo(course, coursesInfo[course.id]);
});
});
示例4:
}).catch((error) => {
if (this.utils.isWebServiceError(error)) {
// The WebService returned an error, assume the preflight failed.
this.accessRuleDelegate.notifyPreflightCheckFailed(rules, quiz, attempt, preflightData, prefetch, siteId);
}
return Promise.reject(error);
});
示例5: runTask
/**
* Open task.
*
* @param {any} task Task to be done.
*/
runTask(task: any): void {
if (task.code == 'submit') {
// This will close the modal and go to the submit.
this.viewCtrl.dismiss(true);
} else if (task.link) {
this.utils.openInBrowser(task.link);
}
}
示例6: notificationClicked
pushNotificationsDelegate.on('click').subscribe((notification) => {
if (utils.isTrueOrOne(notification.notif)) {
// Execute the callback in the Angular zone, so change detection doesn't stop working.
zone.run(() => {
notificationClicked(notification);
});
return true;
}
});
示例7: realGradeValueHelper
/**
* Calculates the real value of a grade based on real_grade_value.
*
* @param {number} value Percentual value from 0 to 100.
* @param {number} max The maximal grade.
* @param {number} decimals Decimals to show in the formatted grade.
* @return {string} Real grade formatted.
*/
protected realGradeValueHelper(value: number, max: number, decimals: number): string {
if (value == null) {
return null;
} else if (max == 0) {
return '0';
} else {
value = this.textUtils.roundToDecimals(max * value / 100, decimals);
return this.utils.formatFloat(value);
}
}
示例8:
return this.loginHelper.getSitePolicy(this.siteId).then((sitePolicy) => {
this.sitePolicy = sitePolicy;
// Try to get the mime type.
return this.utils.getMimeTypeFromUrl(sitePolicy).then((mimeType) => {
const extension = this.mimeUtils.getExtension(mimeType, sitePolicy);
this.showInline = extension == 'html' || extension == 'htm';
}).catch(() => {
// Unable to get mime type, assume it's not supported.
this.showInline = false;
}).finally(() => {
this.policyLoaded = true;
});
}).catch((error) => {
示例9:
return super.callWS().catch((error) => {
if (typeof this.showError == 'undefined' || this.utils.isTrueOrOne(this.showError)) {
this.domUtils.showErrorModalDefault(error, 'core.serverconnection', true);
}
}).finally(() => {