Sha256: 70277b5000673c6f126d98c5a9e1ff5c163a544abc4fd51129d7a813c4121d48

Contents?: true

Size: 1.33 KB

Versions: 4

Compression:

Stored size: 1.33 KB

Contents

//= require "vendor/ejs"
//= require "vendor/glMatrix"
//= require "prototype/class"
//= require "core/math"
//= require "core/util"
//= require "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 != "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

4 entries across 4 versions & 1 rubygems

Version Path
jax-0.0.0.9 src/jax/core.js
jax-0.0.0.8 src/jax/core.js
jax-0.0.0.7 src/jax/core.js
jax-0.0.0.6 src/jax/core.js