本文整理汇总了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);
}