Export mechanism for core
This commit is contained in:
parent
41e9db8235
commit
02da984769
@ -46,31 +46,44 @@
|
||||
return a;
|
||||
}
|
||||
|
||||
exports.torque.clone = function(a) {
|
||||
return exports.torque.extend({}, a);
|
||||
function clone(a) {
|
||||
return extend({}, a);
|
||||
}
|
||||
|
||||
exports.torque.isFunction = function(f) {
|
||||
function isFunction(f) {
|
||||
return typeof f == 'function' || false;
|
||||
}
|
||||
|
||||
exports.torque.isArray = function(value) {
|
||||
function isArray(value) {
|
||||
return value && typeof value == 'object' && Object.prototype.toString.call(value) == '[object Array]';
|
||||
};
|
||||
}
|
||||
|
||||
// types
|
||||
exports.torque.types = {
|
||||
Uint8Array: typeof(window['Uint8Array']) !== 'undefined' ? window.Uint8Array : Array,
|
||||
Uint32Array: typeof(window['Uint32Array']) !== 'undefined' ? window.Uint32Array : Array,
|
||||
Int32Array: typeof(window['Int32Array']) !== 'undefined' ? window.Int32Array: Array
|
||||
var types = {
|
||||
};
|
||||
|
||||
exports.torque.isBrowserSupported = function() {
|
||||
function isBrowserSupported() {
|
||||
return !!document.createElement('canvas');
|
||||
};
|
||||
|
||||
exports.torque.flags = {
|
||||
sprites_to_images: navigator.userAgent.indexOf('Safari') === -1
|
||||
}
|
||||
|
||||
})(typeof exports === "undefined" ? this : exports);
|
||||
function userAgent() {
|
||||
return typeof navigator !== 'undefined' ? navigator.userAgent : '';
|
||||
}
|
||||
|
||||
var flags = {
|
||||
sprites_to_images: userAgent().indexOf('Safari') === -1
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
Event: Event,
|
||||
extend: extend,
|
||||
clone: clone,
|
||||
isFunction: isFunction,
|
||||
isArray: isArray,
|
||||
types: types,
|
||||
isBrowserSupported: isBrowserSupported,
|
||||
flags: flags
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user