js/comm/values/values.js in rsence-pre-2.3.0.16 vs js/comm/values/values.js in rsence-pre-2.3.0.17

- old
+ new

@@ -3,11 +3,11 @@ ** Manages data value synchronization. ** ** Keeps track of all +HValue+ instances present. ***/ //var//RSence.COMM -COMM.Values = HClass.extend({ +COMM.Values = UtilMethods.extend({ /** No constructor, singleton class. **/ constructor: null, @@ -114,17 +114,10 @@ _transporter.sync(); } } }, - // List of primitive object types. - _builtins: [ - 'b', // boolean - 'n', // number - 's' // string - ], - /** = Description * Use this method to detect the type of the object given. * * Returns the type of the object given as a character code. Returns false, * if unknown or unsupported objcet type. @@ -140,33 +133,11 @@ * - '~': Null * - '-': Undefined * **/ type: function(_obj){ - if(_obj === null){ - return '~'; - } - else if (_obj === undefined){ - return '-'; - } - var _type = (typeof _obj).slice(0,1); - if(~this._builtins.indexOf(_type)){ - return _type; - } - else if(_type==='o'){ - if(_obj.constructor === Array){ - return 'a'; // array - } - else if(_obj.constructor === Object){ - return 'h'; // hash - } - else if(_obj.constructor === Date){ - return 'd'; // date - } - return false; - } - return false; + return this.typeChr( _obj ); }, // Returns an encoded version of the array _arr as a string _encodeArr: function(_arr){ var _str = '[', @@ -483,12 +454,10 @@ _id = _tosync.shift(); _value = _values[_id].value; _syncValues.push( [ _id, _value ] ); } } - // console.log('response:',_response); - // console.log('encoded:',_this.encode(_response)); return _this.encode(_response); }, // Old sync implementation: // sync: function(){ @@ -522,10 +491,9 @@ // this.decode = this._nativeDecode; } } } }); - COMM.Values._detectNativeJSONSupport(); // Backwards compatibility assignment for code that still // uses HVM as a reference of the Value Manager: HVM = COMM.Values;