Re-built dist libs

This commit is contained in:
John Martin 2012-10-02 14:24:49 +01:00
parent 1e4a2760f9
commit 7cbaf4b264
2 changed files with 73 additions and 7 deletions

View File

@ -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();

76
dist/recline.js vendored
View File

@ -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; i<n; i++)
if (i in this && this[i]===find)
return i;
return -1;
};
}
if (!('lastIndexOf' in Array.prototype)) {
Array.prototype.lastIndexOf= function(find, i /*opt*/) {
if (i===undefined) i= this.length-1;
if (i<0) i+= this.length;
if (i>this.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<n; i++)
if (i in this)
action.call(that, this[i], i, this);
};
}
if (!('map' in Array.prototype)) {
Array.prototype.map= function(mapper, that /*opt*/) {
var other= new Array(this.length);
for (var i= 0, n= this.length; i<n; i++)
if (i in this)
other[i]= mapper.call(that, this[i], i, this);
return other;
};
}
if (!('filter' in Array.prototype)) {
Array.prototype.filter= function(filter, that /*opt*/) {
var other= [], v;
for (var i=0, n= this.length; i<n; i++)
if (i in this && filter.call(that, v= this[i], i, this))
other.push(v);
return other;
};
}
if (!('every' in Array.prototype)) {
Array.prototype.every= function(tester, that /*opt*/) {
for (var i= 0, n= this.length; i<n; i++)
if (i in this && !tester.call(that, this[i], i, this))
return false;
return true;
};
}
if (!('some' in Array.prototype)) {
Array.prototype.some= function(tester, that /*opt*/) {
for (var i= 0, n= this.length; i<n; i++)
if (i in this && tester.call(that, this[i], i, this))
return true;
return false;
};
}// # Recline Backbone Models
this.recline = this.recline || {};
this.recline.Model = this.recline.Model || {};