本文整理汇总了TypeScript中@ember/debug.debug函数的典型用法代码示例。如果您正苦于以下问题:TypeScript debug函数的具体用法?TypeScript debug怎么用?TypeScript debug使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了debug函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
Libraries.prototype.logVersions = function(): void {
let libs = this._registry;
let nameLengths = libs.map(item => get(item, 'name.length'));
let maxNameLength = Math.max.apply(null, nameLengths);
debug('-------------------------------');
for (let i = 0; i < libs.length; i++) {
let lib = libs[i];
let spaces = new Array(maxNameLength - lib.name.length + 1).join(' ');
debug([lib.name, spaces, ' : ', lib.version].join(''));
}
debug('-------------------------------');
};
示例2: runInDebug
/**
* @ember/debug tests
*/
runInDebug(); // $ExpectError
runInDebug(() => console.log('Should not show up in prod')); // $ExpectType void
// Log a warning if we have more than 3 tomsters
const tomsterCount = 2;
warn('Too many tomsters!'); // $ExpectType void
warn('Too many tomsters!', tomsterCount <= 3); // $ExpectType void
warn('Too many tomsters!', tomsterCount <= 3, { // $ExpectType void
id: 'ember-debug.too-many-tomsters'
});
debug(); // $ExpectError
debug('Too many tomsters!'); // $ExpectType void
debug('Too many tomsters!', 'foo'); // $ExpectError
// Test for truthiness
const str = 'hello';
assert('Must pass a string', typeof str === 'string'); // $ExpectType void
// Fail unconditionally
assert('This code path should never be run'); // $ExpectType void
// next is not called, so no warnings get the default behavior
registerWarnHandler(); // $ExpectError
registerWarnHandler(() => {}); // $ExpectType void
registerWarnHandler((message, { id }, next) => { // $ExpectType void
message; // $ExpectType string
示例3: logErrorMessage
logErrorMessage(subject: string, message: string) {
this.errorToast(subject, message);
debug(message);
}