本文整理匯總了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(() => {