當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript debug.debug函數代碼示例

本文整理匯總了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('-------------------------------');
  };
開發者ID:cibernox,項目名稱:ember.js,代碼行數:13,代碼來源:libraries.ts

示例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
開發者ID:AlexGalays,項目名稱:DefinitelyTyped,代碼行數:30,代碼來源:ember__debug-tests.ts

示例3: logErrorMessage

 logErrorMessage(subject: string, message: string) {
   this.errorToast(subject, message);
   debug(message);
 }
開發者ID:pjcarly,項目名稱:ember-mist-components,代碼行數:4,代碼來源:model-controller.ts


注:本文中的@ember/debug.debug函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。