本文整理匯總了TypeScript中@angular/core.isDevMode函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript isDevMode函數的具體用法?TypeScript isDevMode怎麽用?TypeScript isDevMode使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了isDevMode函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: constructor
constructor(
private ngRedux: NgRedux<IAppState>,
private devTool: DevToolsExtension) {
// configure the store here, this is where the enhancers are set
this.ngRedux.configureStore(rootReducer, {},
isDevMode() ? [createLogger({ collapsed: true })] : [],
isDevMode() && devTool.isEnabled() ? [...enhancers, devTool.enhancer()] : [...enhancers]);
}
示例2: assertInterpolationSymbols
export function assertInterpolationSymbols(identifier: string, value: any): void {
if (isDevMode() && !isBlank(value) && (!isArray(value) || value.length != 2)) {
throw new BaseException(`Expected '${identifier}' to be an array, [start, end].`);
} else if (isDevMode() && !isBlank(value)) {
const start = value[0] as string;
const end = value[1] as string;
// black list checking
INTERPOLATION_BLACKLIST_REGEXPS.forEach(regexp => {
if (regexp.test(start) || regexp.test(end)) {
throw new BaseException(`['${start}', '${end}'] contains unusable interpolation symbol.`);
}
});
}
}
示例3:
return this.accountService.identity().then(account => {
if (!authorities || authorities.length === 0) {
return true;
}
if (account) {
const hasAnyAuthority = this.accountService.hasAnyAuthority(authorities);
if (hasAnyAuthority) {
return true;
}
if (isDevMode()) {
console.error('User has not any of required authorities: ', authorities);
}
return false;
}
this.stateStorageService.storeUrl(url);
this.router.navigate(['accessdenied']).then(() => {
// only show the login dialog, if the user hasn't logged in yet
if (!account) {
this.loginModalService.open();
}
});
return false;
});
示例4: _createConditionalRootRenderer
export function _createConditionalRootRenderer(
rootRenderer: any /** TODO #9100 */, extraTokens: NgProbeToken[]) {
if (isDevMode()) {
return _createRootRenderer(rootRenderer, extraTokens);
}
return rootRenderer;
}
示例5: notify
export function notify(message: string): void {
if (!isDevMode() || message in notifications) {
return;
}
notifications[message] = true;
console.warn(message); // tslint:disable-line
}
示例6: showMessage
export function showMessage(message: string, isMessageShown: boolean): boolean {
if (!isMessageShown && isDevMode()) {
console.warn(message);
}
return true;
}
示例7: canActivate
canActivate(route: ActivatedRouteSnapshot): boolean {
if (!(isDevMode()) && (location.protocol !== 'https:')) {
location.href = 'https:' + window.location.href.substring(window.location.protocol.length);
return false;
}
return true;
}
示例8: sanitizeUrl
export function sanitizeUrl(url: string): string {
url = String(url);
if (url.match(SAFE_URL_PATTERN) || url.match(DATA_URL_PATTERN)) return url;
if (isDevMode()) getDOM().log('WARNING: sanitizing unsafe URL value ' + url);
return 'unsafe:' + url;
}
示例9: ngAfterViewInit
ngAfterViewInit() {
if (!isDevMode() || !this._platform.isBrowser) {
return;
}
this._checkToolbarMixedModes();
this._toolbarRows.changes.subscribe(() => this._checkToolbarMixedModes());
}
示例10: warnOnce
export function warnOnce(msg: string): void {
if (!isDevMode() || _hideMsg || msg in _messagesHash) {
return;
}
_messagesHash[msg] = true;
/*tslint:disable-next-line*/
console.warn(msg);
}