本文整理匯總了TypeScript中loglevel.warn函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript warn函數的具體用法?TypeScript warn怎麽用?TypeScript warn使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了warn函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: onChange
// error handling taken from https://webpack.github.io/docs/node.js-api.html#error-handling
function onChange(err, stats, livereloadServer, onChangeSuccess?) {
if (err) {
// "hard" error
return error(err);
}
if (stats.hasErrors()) {
// "soft" error
return error(stats.toString(statsStringifierOptions));
}
if (stats.hasWarnings()) {
warn(stats.toString(statsStringifierOptions));
}
// filter changes for live reloading
const changedModules = stats.compilation.modules.filter(module => module.built && module.resource);
const changedStyleModules = changedModules.filter(module => module.resource.match(/\.(css|less|sass)$/));
let hasOnlyStyleChanges = changedModules.length === changedStyleModules.length;
if (hasOnlyStyleChanges) {
livereloadServer.refresh('style.css');
} else {
livereloadServer.refresh('index.html');
}
if (onChangeSuccess) {
onChangeSuccess(stats);
}
}
示例2: onBuild
// error handling taken from https://webpack.github.io/docs/node.js-api.html#error-handling
function onBuild(
resolve: any,
reject: any,
err: any,
stats: compiler.Stats,
watcher?: any
) {
if (err) {
// "hard" error
return reject(err);
}
if (stats.hasErrors()) {
// "soft" error
return reject(stringifyStats(stats));
}
if (stats.hasWarnings()) {
warn(stringifyStats(stats));
}
if (isVerbose()) {
info(stringifyStats(stats));
}
// note: watcher is optional
resolve(watcher);
}
示例3: function
Meteor.publish(GAME_SUBSCRIPTION_NAME, function (options:GameSubscriptionOptions) {
if (!this.userId) {
log.warn('Subscription denied due to no userId');
return this.ready(); // Must be logged in
}
let gameUserIds:string[] = [];
let handsCursor = HandCollection.find({gameId: options.gameId});
handsCursor.forEach((game:Hand)=> {
gameUserIds.push(game.userId);
});
if (gameUserIds.indexOf(this.userId)===-1) {
let user:Meteor.User = Meteor.users.find({_id: this.userId});
if (!AccountsAdminTools.isAdmin(user))
return this.ready(); // Game only visible to its players or admins
}
let userCursor = Meteor.users.find(
{_id: {$in: gameUserIds}},
{
fields: {
username: true,
profile: true,
emails: true
}
}
);
let actionCursor = GamePlayActionCollection.find({gameId: options.gameId});
// log.debug("publish gameinfo: " + ", GameId:" + options.gameId + ", userCount: " + userCursor.count(), ", hands count: " + handsCursor.count(), " action count:" + actionCursor.count())
return [
userCursor,
handsCursor,
actionCursor
];
});
示例4:
return Observable.forkJoin(catchedObservables).map(res => {
if (errors.length > 0) {
log.warn("session loading failed", errors);
// just report the first error, this is what the forkJoin would have done by default anyway
throw errors[0];
} else {
return res;
}
});
示例5:
return this.createNewTempSession().map((newSessionId: string) => {
if (newSessionId !== null) {
log.info("created new session", newSessionId);
this.routeService.navigateToSession(newSessionId);
return false;
} else {
log.warn("creating new session failed, going to sessions list");
this.routeService.navigateToSessions();
return false;
}
});
示例6:
.catch(e => {
if (e.status === 403) {
log.info("auth guard got 403, redirecting to login");
} else {
log.warn("error in auth guard, redirecting to login");
}
this.routeService.redirectToLoginAndBackWithCustomCurrentUrl(
state.url
);
return Observable.of(false);
});
示例7: isOldEnzyme
function isOldEnzyme() {
const { devDependencies = {} } = project;
const { enzyme = '' } = devDependencies;
if (
enzyme.startsWith('2.') ||
enzyme.startsWith('~2.') ||
enzyme.startsWith('^2.')
) {
warn('You use an old Enzyme version. Please upgrade.');
return true;
} else {
return false;
}
}
示例8: canActivate
canActivate(
route: ActivatedRouteSnapshot,
state: RouterStateSnapshot
): boolean {
const appName = route.url[0].path;
if (appName === "chipster" || appName === "mylly") {
this.routeService.setBackupAppName(appName);
return true;
} else {
log.warn("invalid appName", appName, "redirecting to chipster home");
this.router.navigateByUrl("/chipster/home");
return false;
}
}
示例9: handleNotifier
return function handleNotifier() {
switch (state) {
case 'pending':
child.kill();
break;
case 'outdated':
info(message);
break;
case 'up-to-date':
debug(message);
break;
case 'warn':
warn(message);
break;
}
};
示例10: onBuild
// error handling taken from https://webpack.github.io/docs/node.js-api.html#error-handling
function onBuild(resolve, reject, err, stats, watcher?) {
if (err) {
// "hard" error
return reject(err);
}
if (stats.hasErrors()) {
// "soft" error
return reject(stats.toString(statsStringifierOptions));
}
if (stats.hasWarnings()) {
warn(stats.toString(statsStringifierOptions));
}
// note: watcher is optional
resolve(watcher);
}