Sha256: e03630630ac596674ceaac4a495e1eadee186d0e20d229cef9e5c91913440c4d

Contents?: true

Size: 1.38 KB

Versions: 5

Compression:

Stored size: 1.38 KB

Contents

//= require "jax/vendor/ejs"
//= require "jax/vendor/glMatrix"
//= require "jax/prototype/class"
//= require "jax/core/helper"
//= require "jax/core/math"
//= require "jax/core/util"
//= require "jax/core/matrix_stack"

/**
 * Global#debugAssert(expr[, msg]) -> undefined
 * a global debugAssert method that will do nothing in production, and fail if expr is false
 * in any other run mode. If msg is given, an error with that message is raised. Otherwise,
 * a more generic error is raised.
 **/
window.debugAssert = function(expr, msg) {
  if (Jax.environment != Jax.PRODUCTION && !expr)
  {
    var error = new Error(msg || "debugAssert failed");
    if (error.stack) error = new Error((msg || "debugAssert failed")+"\n\n"+error.stack);
    throw error;
  }
};

// If glMatrixArrayType isn't simply Array, then most browsers (FF, Chrome) have a pretty
// crappy implementation of toString() that actually tells you nothing about the array's
// contents. This makes the #toString method a little more Array-like.
//
// Ex: "[Float32Array: -100,-100,-100]"
if (glMatrixArrayType.prototype.toString != Array.prototype.toString) {
  glMatrixArrayType.prototype.toString = function() {
    var s = "["+glMatrixArrayType.name+": ";
    var d = false;
    for (var i in this) {
      if (parseInt(i) == i) {
        if (d) s += ",";
        s += this[i];
        d = true;
      }
    }
    s += "]";
    return s;
  }
}

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
jax-2.0.4 lib/assets/javascripts/jax/core.js
jax-2.0.3 lib/assets/javascripts/jax/core.js
jax-2.0.2 lib/assets/javascripts/jax/core.js
jax-2.0.1 lib/assets/javascripts/jax/core.js
jax-2.0.0 lib/assets/javascripts/jax/core.js