How to use the base.logger.warn function in base

To help you get started, we’ve selected a few base 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 gameclosure / devkit-core / timestep / src / ui / resource / loader.js View on Github external
}

    var cache = loadMethod.cache;
    if (cache) {
      var asset = cache[url];
      if (asset) {
        return cb && cb(asset, index);
      }
    }

    if (priority === null || priority === undefined) {
      priority = this._priorities[url];
    }

    if (this._logRequests) {
      logger.warn('Asset Requested:', url);
    }

    if (cb) {
      var callbackData = new AssetCallback(cb, index);
      var assetRequests = this._assetCallbacks[url];
      if (assetRequests) {
        assetRequests.push(callbackData);
      } else {
        this._assetCallbacks[url] = [callbackData];
      }
    }

    if (!isExplicit) {
      // Only explicit load requests go through
      return;
    }
github gameclosure / devkit-core / timestep / src / ui / resource / loader.js View on Github external
_onAssetLoaded (asset, url, cache) {
    // Adding asset to cache
    if (cache) {
      cache[url] = asset;
    }

    if (this._logRequests) {
      logger.warn('Asset Loaded:', url);
    }

    var callbacksData = this._assetCallbacks[url];
    if (callbacksData) {
      for (var c = 0; c < callbacksData.length; c += 1) {
        var callbackData = callbacksData[c];
        callbackData.cb(asset, callbackData.index);
      }
      delete this._assetCallbacks[url];
    }

    // Asset no longer a request
    delete this._currentRequests[url];

  }
github gameclosure / devkit-core / timestep / src / ui / ScoreView.js View on Github external
setCharacterData (data) {
    this._characterData = data;
    var srcHeight = 0;
    for (var i in data) {
      var d = data[i];
      d.img = new Image({ url: d.image });
      var map = d.img.getMap();
      d.width = d.width || (map.width + map.marginLeft + map.marginRight) /
        map.scale;
      var h = (map.height + map.marginTop + map.marginBottom) / map.scale;
      if (srcHeight === 0 && h > 0) {
        // accept the first height we find and use it
        srcHeight = h;
      } else if (srcHeight !== h) {
        // all assets passed to ScoreViews should have the same height
        logger.warn(this.getTag() + ': Art Height Mismatch!', d.image);
      }
    }
    this._srcHeight = srcHeight || this._srcHeight;
    this._text && this.setText(this._text);
  }
  setText (text) {
github gameclosure / devkit-core / timestep / src / ui / ParticleEngine.js View on Github external
obtainParticleArray (count, opts) {
    opts = opts || {};

    count = performance.getAdjustedParticleCount(count, opts.performanceScore,
      opts.allowReduction);

    for (var i = 0; i < count; i++) {
      var particle = this._freeParticles.pop();
      if (!particle) {
        particle = new Particle(this);
        if (this._logViewCreation) {
          logger.warn(this.getTag(), 'created Particle');
        }
      }
      this._particleDataArray.push(particle);
    }

    // OK to use an array here
    return this._particleDataArray;
  }
github gameclosure / devkit-core / timestep / src / ui / resource / loader.js View on Github external
var callbackData = new AssetCallback(cb, index);
      var assetRequests = this._assetCallbacks[url];
      if (assetRequests) {
        assetRequests.push(callbackData);
      } else {
        this._assetCallbacks[url] = [callbackData];
      }
    }

    if (!isExplicit) {
      // Only explicit load requests go through
      return;
    }

    if (this._logRequests) {
      logger.warn('Asset Request went through:', url);
    }

    if (!this._currentRequests[url]) {
      this._currentRequests[url] = true;
      this._nbRequestedResources += 1;
      loadMethod(url, (asset) => this._onAssetLoaded(asset, url, cache), this, priority, isExplicit);
    }
  }
github gameclosure / devkit-core / timestep / src / movieclip / AnimationData.js View on Github external
processSymbol (symbols, symbolID, elements, transforms, colors) {
    var symbolData = symbols[symbolID];
    if (!symbolData) {
      logger.warn('Reference to non-existent symbol: ' + symbolID);
    }

    var children = symbolData.children;
    var frameCount = symbolData.frameCount;

    var timeline = new Array(frameCount);
    for (var f = 0; f < timeline.length; f += 1) {
      timeline[f] = [];
    }

    for (var c = children.length - 1; c >= 0; c -= 1) {
      var instanceData = children[c];
      var frames = instanceData.frames;
      var instanceFirstFrame = frames[0];
      var instanceFrameCount = frames[1] - instanceFirstFrame + 1;
      var instanceTransforms = instanceData.transforms;
github gameclosure / devkit-core / timestep / src / ui / ScoreView.js View on Github external
}

    var i = 0;
    while (i < textLength) {
      var character = text[i];
      var data = this._characterData[character];
      if (data) {
        this._activeCharacters[i] = data;
        textWidth += data.width;
        if (i < oldTextLength && oldText[i] === character) {
          this._ignoreCharacters.push(true);
        } else {
          this._ignoreCharacters.push(false);
        }
      } else {
        logger.warn('WARNING! ScoreView.setText, no data for: ' + character);
      }
      i++;
    }
    textWidth *= scale;
    textWidth += (textLength - 1) * spacing;

    if (width < textWidth) {
      this._container.style.scale = width / textWidth;
    } else {
      this._container.style.scale = 1;
    }

    if (this._horizontalAlign === 'center') {
      offsetX = (width - textWidth) / 2;
    } else if (this._horizontalAlign === 'right') {
      offsetX = width - textWidth;
github gameclosure / devkit-core / timestep / src / movieclip / MovieClip.js View on Github external
if (this._library[animationName]) {
          this.play(animationName, callback, loop);
        }
      };

      this.once(MovieClip.LOADED, this._playOnLoadCallback);
      return;
    }

    this._frameDirty = animationName !== this._animationName;
    this._animationName = animationName;
    this.looping = loop || false;
    this.isPlaying = true;
    this.animation = this._substitutes[animationName] || this._library[animationName];
    if (!this.animation) {
      logger.warn('Missing animation: ' + animationName);
      this.animation = AnimationData.EMPTY_SYMBOL;
    }

    this.timeline = this.animation.timeline;
    this.duration = this.animation.duration;
    this.frameCount = this.animation.duration;
    this.frame = 0;
    this.framesElapsed = 0;
    this._callback = callback || null;
  }