How to use the @embroider/core.debug function in @embroider/core

To help you get started, we’ve selected a few @embroider/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github embroider-build / embroider / packages / compat / src / v1-addon.ts View on Github external
protected throughTreeCache(name: string, category: string, fn: () => Tree | undefined): Tree | undefined {
    let cacheKey;
    if (typeof this.addonInstance.cacheKeyForTree === 'function') {
      cacheKey = this.addonInstance.cacheKeyForTree(name);
      if (cacheKey) {
        cacheKey = cacheKey + category;
        let cachedTree = this.app.addonTreeCache.get(cacheKey);
        if (cachedTree) {
          debug('cache hit %s %s %s', this.name, name, category);
          return cachedTree;
        }
      }
    }
    debug('cache miss %s %s %s', this.name, name, category);
    let tree = fn();
    if (tree && cacheKey) {
      this.app.addonTreeCache.set(cacheKey, tree);
    }
    return tree;
  }
github embroider-build / embroider / packages / compat / src / v1-addon.ts View on Github external
protected throughTreeCache(name: string, category: string, fn: () => Tree | undefined): Tree | undefined {
    let cacheKey;
    if (typeof this.addonInstance.cacheKeyForTree === 'function') {
      cacheKey = this.addonInstance.cacheKeyForTree(name);
      if (cacheKey) {
        cacheKey = cacheKey + category;
        let cachedTree = this.app.addonTreeCache.get(cacheKey);
        if (cachedTree) {
          debug('cache hit %s %s %s', this.name, name, category);
          return cachedTree;
        }
      }
    }
    debug('cache miss %s %s %s', this.name, name, category);
    let tree = fn();
    if (tree && cacheKey) {
      this.app.addonTreeCache.set(cacheKey, tree);
    }
    return tree;
  }