From 7cbaf4b2645954c0857ace7896ae423e4adb0b24 Mon Sep 17 00:00:00 2001 From: John Martin Date: Tue, 2 Oct 2012 14:24:49 +0100 Subject: [PATCH] Re-built dist libs --- dist/recline.dataset.js | 4 +-- dist/recline.js | 76 ++++++++++++++++++++++++++++++++++++++--- 2 files changed, 73 insertions(+), 7 deletions(-) diff --git a/dist/recline.dataset.js b/dist/recline.dataset.js index 05ae6add..86359d90 100644 --- a/dist/recline.dataset.js +++ b/dist/recline.dataset.js @@ -608,7 +608,7 @@ this.recline.Backend.Memory = this.recline.Backend.Memory || {}; }); }; - this.delete = function(doc) { + this.remove = function(doc) { var newdocs = _.reject(self.data, function(internalDoc) { return (doc.id === internalDoc.id); }); @@ -623,7 +623,7 @@ this.recline.Backend.Memory = this.recline.Backend.Memory || {}; self.update(record); }); _.each(changes.deletes, function(record) { - self.delete(record); + self.remove(record); }); dfd.resolve(); return dfd.promise(); diff --git a/dist/recline.js b/dist/recline.js index ed8a7054..7317b043 100644 --- a/dist/recline.js +++ b/dist/recline.js @@ -529,7 +529,7 @@ this.recline.Backend.ElasticSearch = this.recline.Backend.ElasticSearch || {}; // // @param {Object} id id of object to delete // @return deferred supporting promise API - this.delete = function(id) { + this.remove = function(id) { url = this.endpoint; url += '/' + id; return makeRequest({ @@ -669,7 +669,7 @@ this.recline.Backend.ElasticSearch = this.recline.Backend.ElasticSearch || {}; else if (changes.updates.length >0) { return es.upsert(changes.updates[0]); } else if (changes.deletes.length > 0) { - return es.delete(changes.deletes[0].id); + return es.remove(changes.deletes[0].id); } }; @@ -930,7 +930,7 @@ this.recline.Backend.Memory = this.recline.Backend.Memory || {}; }); }; - this.delete = function(doc) { + this.remove = function(doc) { var newdocs = _.reject(self.data, function(internalDoc) { return (doc.id === internalDoc.id); }); @@ -945,7 +945,7 @@ this.recline.Backend.Memory = this.recline.Backend.Memory || {}; self.update(record); }); _.each(changes.deletes, function(record) { - self.delete(record); + self.remove(record); }); dfd.resolve(); return dfd.promise(); @@ -1180,7 +1180,73 @@ my.Transform.mapDocs = function(docs, editFunc) { }; }(this.recline.Data)) -// # Recline Backbone Models +// This file adds in full array method support in browsers that don't support it +// see: http://stackoverflow.com/questions/2790001/fixing-javascript-array-functions-in-internet-explorer-indexof-foreach-etc + +// Add ECMA262-5 Array methods if not supported natively +if (!('indexOf' in Array.prototype)) { + Array.prototype.indexOf= function(find, i /*opt*/) { + if (i===undefined) i= 0; + if (i<0) i+= this.length; + if (i<0) i= 0; + for (var n= this.length; ithis.length-1) i= this.length-1; + for (i++; i-->0;) /* i++ because from-argument is sadly inclusive */ + if (i in this && this[i]===find) + return i; + return -1; + }; +} +if (!('forEach' in Array.prototype)) { + Array.prototype.forEach= function(action, that /*opt*/) { + for (var i= 0, n= this.length; i