Permalink
Browse files

Refactoring engine to use R.is...() functions instead of $.is...()

Rebuilt engine file
Removed jquery-ui-1.8.8 and replaced with 1.10.1
Adding Jasmine test adapter and spec tester
  • Loading branch information...
1 parent 93217ec commit 9e38c44413889ae97b308d9ee2d9b415f617cd08 @bfattori committed Mar 19, 2013
View
@@ -273,7 +273,7 @@ R.engine.BaseObject = function () {
*/
addEvents:function (handlers) {
var self = this;
- if ($.isArray(handlers)) {
+ if (R.isArray(handlers)) {
for (var h = 0; h < handlers.length; h++) {
var method = this[handlers[h]];
this.addEvent(handlers[h].substr(2).toLowerCase(), method);
@@ -64,31 +64,31 @@ R.debug.Metrics = Base.extend(/** @scope R.debug.Metrics.prototype */{
/**
* Toggle the display of the metrics window. Any metrics
* that are being tracked will be reported in this window.
- * @memberOf R.debug.Metrics
+ * @memberof R.debug.Metrics
*/
toggleMetrics:function () {
R.debug.Metrics.showMetricsWindow = !R.debug.Metrics.showMetricsWindow;
},
/**
* Show the metrics window
- * @memberOf R.debug.Metrics
+ * @memberof R.debug.Metrics
*/
showMetrics:function () {
R.debug.Metrics.showMetricsWindow = true;
},
/**
* Show a graph of the engine profile
- * @memberOf R.debug.Metrics
+ * @memberof R.debug.Metrics
*/
showProfile:function () {
R.debug.Metrics.showMetricsProfile = true;
},
/**
* Hide the metrics window
- * @memberOf R.debug.Metrics
+ * @memberof R.debug.Metrics
*/
hideMetrics:function () {
R.debug.Metrics.showMetricsWindow = false;
@@ -182,7 +182,7 @@ R.debug.Metrics = Base.extend(/** @scope R.debug.Metrics.prototype */{
* The default is for metrics to be calculated every 10 engine frames.
*
* @param sampleRate {Number} The number of ticks between samples
- * @memberOf R.debug.Metrics
+ * @memberof R.debug.Metrics
*/
setSampleRate:function (sampleRate) {
R.debug.Metrics.lastMetricSample = 1;
@@ -202,7 +202,7 @@ R.debug.Metrics = Base.extend(/** @scope R.debug.Metrics.prototype */{
* @param value {String/Number} The value of the metric.
* @param smoothing {Boolean} <tt>true</tt> to use 3 point average smoothing
* @param fmt {String} The way the value should be formatted in the display (e.g. "#ms")
- * @memberOf R.debug.Metrics
+ * @memberof R.debug.Metrics
*/
add:function (metricName, value, smoothing, fmt) {
if (smoothing) {
@@ -226,7 +226,7 @@ R.debug.Metrics = Base.extend(/** @scope R.debug.Metrics.prototype */{
* Remove a metric from the display
*
* @param metricName {String} The name of the metric to remove
- * @memberOf R.debug.Metrics
+ * @memberof R.debug.Metrics
*/
remove:function (metricName) {
R.debug.Metrics.metrics[metricName] = null;
@@ -236,7 +236,7 @@ R.debug.Metrics = Base.extend(/** @scope R.debug.Metrics.prototype */{
/**
* Updates the display of the metrics window.
* @private
- * @memberOf R.debug.Metrics
+ * @memberof R.debug.Metrics
*/
update:function () {
var h = "", ctx;
@@ -311,7 +311,7 @@ R.debug.Metrics = Base.extend(/** @scope R.debug.Metrics.prototype */{
/**
* Run the metrics display.
* @private
- * @memberOf R.debug.Metrics
+ * @memberof R.debug.Metrics
*/
doMetrics:function () {
// Output any metrics
@@ -45,7 +45,7 @@ R.debug.Profiler = {
/**
* Start the profiler.
- * @memberOf R.debug.Profiler
+ * @memberof R.debug.Profiler
*/
R.debug.Profiler.start = function () {
R.debug.Profiler.resetProfiles();
@@ -57,7 +57,7 @@ R.debug.Profiler.start = function () {
/**
* Stop the profiler, dumping whatever was being profiled.
- * @memberOf R.debug.Profiler
+ * @memberof R.debug.Profiler
*/
R.debug.Profiler.stop = function () {
R.debug.Profiler.dump();
@@ -82,7 +82,7 @@ R.debug.Profiler.stop = function () {
</pre>
*
* @param prof {String} The name of the profile
- * @memberOf R.debug.Profiler
+ * @memberof R.debug.Profiler
*/
R.debug.Profiler.enter = function (prof) {
if (!R.debug.Profiler.running) {
@@ -113,7 +113,7 @@ R.debug.Profiler.enter = function (prof) {
* you properly balance your profile stack. Too many "exit" calls
* will result in a stack underflow. Missing calls to "exit" will
* result in a stack overflow.
- * @memberOf R.debug.Profiler
+ * @memberof R.debug.Profiler
*/
R.debug.Profiler.exit = function () {
if (!R.debug.Profiler.running) {
@@ -141,7 +141,7 @@ R.debug.Profiler.exit = function () {
/**
* Reset any currently running profiles and clear the stack.
- * @memberOf R.debug.Profiler
+ * @memberof R.debug.Profiler
*/
R.debug.Profiler.resetProfiles = function () {
R.debug.Profiler.profileStack = [];
@@ -152,7 +152,7 @@ R.debug.Profiler.resetProfiles = function () {
/**
* Dump the profiles that are currently in the stack to a debug window.
* The profile stack will be cleared after the dump.
- * @memberOf R.debug.Profiler
+ * @memberof R.debug.Profiler
*/
R.debug.Profiler.dump = function () {
if (!R.debug.Profiler.running) {
@@ -193,7 +193,7 @@ R.debug.Profiler.dump = function () {
/**
* Wire the objects in the array with profiling
* @param objArray {Array} Object array
- * @memberOf R.debug.Profiler
+ * @memberof R.debug.Profiler
*/
R.debug.Profiler.wireObjects = function (objArray) {
for (var obj in objArray) {
@@ -48,7 +48,7 @@ R._namespaces = {};
/**
* The global namespace, typically the window object
- * @memberOf R
+ * @memberof R
* @type {Object}
*/
R.global = this;
@@ -96,7 +96,7 @@ if (R.browser.firefox) {
* Declare a new namespace in R.
* @param ns {String} The namespace to declare
* @exception Throws an exception if the namespace is already declared
- * @memberOf R
+ * @memberof R
*/
R.namespace = function (ns) {
if (R._namespaces[ns]) {
@@ -118,7 +118,7 @@ R.namespace = function (ns) {
* Throw an "unsupported" exception for the given method in the class.
* @param method {String} The method name
* @param clazz {Class} The class object
- * @memberOf R
+ * @memberof R
* @exception Throws a "[method] is unsupported in [Class]" error
*/
R._unsupported = function (method, clazz) {
@@ -132,7 +132,7 @@ R.str = Object.prototype.toString;
* Check if the given object is a function
* @param obj {Object} The object to test
* @return {Boolean}
- * @memberOf R
+ * @memberof R
*/
R.isFunction = function (obj) {
return (R.str.call(obj) === "[object Function]");
@@ -142,7 +142,7 @@ R.isFunction = function (obj) {
* Check if the given object is an array
* @param obj {Object} The object to test
* @return {Boolean}
- * @memberOf R
+ * @memberof R
*/
R.isArray = function (obj) {
return (R.str.call(obj) === "[object Array]");
@@ -152,7 +152,7 @@ R.isArray = function (obj) {
* Check if the given object is a string
* @param obj {Object} The object to test
* @return {Boolean}
- * @memberOf R
+ * @memberof R
*/
R.isString = function (obj) {
return (R.str.call(obj) === "[object String]");
@@ -162,7 +162,7 @@ R.isString = function (obj) {
* Check if the given object is a number
* @param obj {Object} The object to test
* @return {Boolean}
- * @memberOf R
+ * @memberof R
*/
R.isNumber = function (obj) {
return (R.str.call(obj) === "[object Number]");
@@ -173,7 +173,7 @@ R.isNumber = function (obj) {
* of an object unless the object is known to be defined.
* @param obj {Object} The object to test
* @returns {boolean}
- * @memberOf R
+ * @memberof R
*/
R.isUndefined = function(obj) {
return typeof obj === "undefined";
@@ -183,7 +183,7 @@ R.isUndefined = function(obj) {
* Check if the given object is null.
* @param obj {Object} The object to test
* @returns {boolean}
- * @memberOf R
+ * @memberof R
*/
R.isNull = function(obj) {
return obj === null;
@@ -193,7 +193,7 @@ R.isNull = function(obj) {
* Test if the object is undefined, null, or a string and is empty
* @param obj {Object} The object to test
* @return {Boolean}
- * @memberOf R
+ * @memberof R
*/
R.isEmpty = function (obj) {
return R.isUndefined(obj) || R.isNull(obj) || (R.isString(obj) && $.trim(obj) === "");
@@ -206,7 +206,7 @@ R.isEmpty = function (obj) {
* @param props {Object} Properties which are available on the object class. The format is [getterFn, setterFn]. If
* either is null, the corresponding property accessor method will not be assigned.
* @return {Function} A new
- * @memberOf R
+ * @memberof R
*/
R.make = function (clazz, props) {
// Get the constructor (if it exists)
@@ -372,7 +372,7 @@ R.engine.Linker = Base.extend(/** @scope R.engine.Linker.prototype */{
var shortName = clazz.shift(), classObjDef = pkg[shortName];
// We can initialize the class
- if ($.isFunction(classObjDef)) {
+ if (R.isFunction(classObjDef)) {
pkg[shortName] = classObjDef();
} else {
pkg[shortName] = classObjDef;
Oops, something went wrong.

0 comments on commit 9e38c44

Please sign in to comment.