Skip to content

Commit 8717141

Browse files
committed
Fixes #235.
Stable Version 1.4.0.
1 parent ad29d65 commit 8717141

File tree

13 files changed

+95
-66
lines changed

13 files changed

+95
-66
lines changed

CHANGELOG.md

+9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
##### 1.4.0 - 09 November 2014
2+
3+
###### Backwards compatible API changes
4+
- #227 - Supporting methods on model instances (again)
5+
6+
###### Backwards compatible bug fixes
7+
- #234 - Fixed an issue with DSLocalStorageAdapter.update
8+
- #235 - IE 8 support
9+
110
##### 1.3.0 - 07 November 2014
211

312
###### Backwards compatible API changes

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Unlike Backbone and Ember Models, angular-data does not require the use of gette
88

99
Supporting relations, computed properties, model lifecycle control and a slew of other features, angular-data is the tool for giving your data the respect it deserves.
1010

11-
__Latest Release:__ [1.3.0](https://github.com/jmdobry/angular-data/releases/tag/1.3.0)
11+
__Latest Release:__ [1.4.0](https://github.com/jmdobry/angular-data/releases/tag/1.4.0)
1212

1313
Angular-data is finally 1.0.!
1414

bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"author": "Jason Dobry",
33
"name": "angular-data",
44
"description": "Data store for Angular.js.",
5-
"version": "1.3.0",
5+
"version": "1.4.0",
66
"homepage": "http://angular-data.pseudobry.com/",
77
"repository": {
88
"type": "git",

dist/angular-data.js

+40-30
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @author Jason Dobry <[email protected]>
33
* @file angular-data.js
4-
* @version 1.3.0 - Homepage <http://angular-data.pseudobry.com/>
4+
* @version 1.4.0 - Homepage <http://angular-data.pseudobry.com/>
55
* @copyright (c) 2014 Jason Dobry <https://github.com/jmdobry/>
66
* @license MIT <https://github.com/jmdobry/angular-data/blob/master/LICENSE>
77
*
@@ -26,6 +26,7 @@
2626
// Copyright 2014 Jason Dobry
2727
//
2828
// Summary of modifications:
29+
// Fixed use of "delete" keyword for IE8 compatibility
2930
// Removed all code related to:
3031
// - ArrayObserver
3132
// - ArraySplice
@@ -523,7 +524,7 @@
523524
var expectedRecordTypes = {
524525
add: true,
525526
update: true,
526-
delete: true
527+
'delete': true
527528
};
528529

529530
function diffObjectFromChangeRecords(object, changeRecords, oldValues) {
@@ -2826,13 +2827,12 @@ function create(resourceName, attrs, options) {
28262827
} else {
28272828
return DS.createInstance(resourceName, attrs, options);
28282829
}
2829-
})
2830-
.catch(function (err) {
2831-
if (options.eagerInject && options.cacheResponse) {
2832-
DS.eject(resourceName, injected[definition.idAttribute], { notify: false });
2833-
}
2834-
return DS.$q.reject(err);
2835-
});
2830+
})['catch'](function (err) {
2831+
if (options.eagerInject && options.cacheResponse) {
2832+
DS.eject(resourceName, injected[definition.idAttribute], { notify: false });
2833+
}
2834+
return DS.$q.reject(err);
2835+
});
28362836
}
28372837
} catch (err) {
28382838
deferred.reject(err);
@@ -2939,12 +2939,12 @@ function destroy(resourceName, id, options) {
29392939
}
29402940
DS.eject(resourceName, id);
29412941
return id;
2942-
}).catch(function (err) {
2943-
if (options.eagerEject && item) {
2944-
DS.inject(resourceName, item);
2945-
}
2946-
return DS.$q.reject(err);
2947-
});
2942+
})['catch'](function (err) {
2943+
if (options.eagerEject && item) {
2944+
DS.inject(resourceName, item);
2945+
}
2946+
return DS.$q.reject(err);
2947+
});
29482948
} catch (err) {
29492949
deferred.reject(err);
29502950
return deferred.promise;
@@ -5369,7 +5369,7 @@ function createInstance(resourceName, attrs, options) {
53695369
var item;
53705370

53715371
if (options.useClass) {
5372-
var Func = definition[definition.class];
5372+
var Func = definition[definition['class']];
53735373
item = new Func();
53745374
} else {
53755375
item = {};
@@ -5398,7 +5398,17 @@ var instanceMethods = [
53985398
'save',
53995399
'update',
54005400
'destroy',
5401-
'refresh'
5401+
'refresh',
5402+
'loadRelations',
5403+
'changeHistory',
5404+
'changes',
5405+
'hasChanges',
5406+
'lastModified',
5407+
'lastSaved',
5408+
'link',
5409+
'linkInverse',
5410+
'previous',
5411+
'unlinkInverse'
54025412
];
54035413

54045414
var methodsToProxy = [
@@ -5620,13 +5630,13 @@ function defineResource(definition) {
56205630
});
56215631

56225632
// Create the wrapper class for the new resource
5623-
def.class = DSUtils.pascalCase(defName);
5624-
eval('function ' + def.class + '() {}');
5625-
def[def.class] = eval(def.class);
5633+
def['class'] = DSUtils.pascalCase(defName);
5634+
eval('function ' + def['class'] + '() {}');
5635+
def[def['class']] = eval(def['class']);
56265636

56275637
// Apply developer-defined methods
56285638
if (def.methods) {
5629-
DSUtils.deepMixIn(def[def.class].prototype, def.methods);
5639+
DSUtils.deepMixIn(def[def['class']].prototype, def.methods);
56305640
}
56315641

56325642
// Prepare for computed properties
@@ -5658,13 +5668,13 @@ function defineResource(definition) {
56585668
});
56595669
});
56605670

5661-
def[def.class].prototype.DSCompute = function () {
5671+
def[def['class']].prototype.DSCompute = function () {
56625672
return DS.compute(def.name, this);
56635673
};
56645674
}
56655675

56665676
DSUtils.forEach(instanceMethods, function (name) {
5667-
def[def.class].prototype['DS' + DSUtils.pascalCase(name)] = function () {
5677+
def[def['class']].prototype['DS' + DSUtils.pascalCase(name)] = function () {
56685678
var args = Array.prototype.slice.call(arguments);
56695679
args.unshift(this[def.idAttribute]);
56705680
args.unshift(def.name);
@@ -6581,8 +6591,8 @@ function _inject(definition, resource, attrs, options) {
65816591

65826592
if (definition.idAttribute in changed) {
65836593
$log.error('Doh! You just changed the primary key of an object! ' +
6584-
'I don\'t know how to handle this yet, so your data for the "' + definition.name +
6585-
'" resource is now in an undefined (probably broken) state.');
6594+
'I don\'t know how to handle this yet, so your data for the "' + definition.name +
6595+
'" resource is now in an undefined (probably broken) state.');
65866596
}
65876597
}
65886598

@@ -6616,10 +6626,10 @@ function _inject(definition, resource, attrs, options) {
66166626

66176627
if (!item) {
66186628
if (options.useClass) {
6619-
if (attrs instanceof definition[definition.class]) {
6629+
if (attrs instanceof definition[definition['class']]) {
66206630
item = attrs;
66216631
} else {
6622-
item = new definition[definition.class]();
6632+
item = new definition[definition['class']]();
66236633
}
66246634
} else {
66256635
item = {};
@@ -7434,7 +7444,7 @@ function IllegalArgumentError(message) {
74347444
this.message = message || 'Illegal Argument!';
74357445
}
74367446

7437-
IllegalArgumentError.prototype = Object.create(Error.prototype);
7447+
IllegalArgumentError.prototype = new Error();
74387448
IllegalArgumentError.prototype.constructor = IllegalArgumentError;
74397449

74407450
/**
@@ -7470,7 +7480,7 @@ function RuntimeError(message) {
74707480
this.message = message || 'RuntimeError Error!';
74717481
}
74727482

7473-
RuntimeError.prototype = Object.create(Error.prototype);
7483+
RuntimeError.prototype = new Error();
74747484
RuntimeError.prototype.constructor = RuntimeError;
74757485

74767486
/**
@@ -7506,7 +7516,7 @@ function NonexistentResourceError(resourceName) {
75067516
this.message = (resourceName || '') + ' is not a registered resource!';
75077517
}
75087518

7509-
NonexistentResourceError.prototype = Object.create(Error.prototype);
7519+
NonexistentResourceError.prototype = new Error();
75107520
NonexistentResourceError.prototype.constructor = NonexistentResourceError;
75117521

75127522
/**

dist/angular-data.min.js

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/observe-js/observe-js.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
// Copyright 2014 Jason Dobry
1717
//
1818
// Summary of modifications:
19+
// Fixed use of "delete" keyword for IE8 compatibility
1920
// Removed all code related to:
2021
// - ArrayObserver
2122
// - ArraySplice
@@ -513,7 +514,7 @@
513514
var expectedRecordTypes = {
514515
add: true,
515516
update: true,
516-
delete: true
517+
'delete': true
517518
};
518519

519520
function diffObjectFromChangeRecords(object, changeRecords, oldValues) {

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "angular-data",
33
"description": "Data store for Angular.js.",
4-
"version": "1.3.0",
4+
"version": "1.4.0",
55
"homepage": "http://angular-data.pseudobry.com",
66
"repository": {
77
"type": "git",

src/datastore/async_methods/create.js

+6-7
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,12 @@ function create(resourceName, attrs, options) {
132132
} else {
133133
return DS.createInstance(resourceName, attrs, options);
134134
}
135-
})
136-
.catch(function (err) {
137-
if (options.eagerInject && options.cacheResponse) {
138-
DS.eject(resourceName, injected[definition.idAttribute], { notify: false });
139-
}
140-
return DS.$q.reject(err);
141-
});
135+
})['catch'](function (err) {
136+
if (options.eagerInject && options.cacheResponse) {
137+
DS.eject(resourceName, injected[definition.idAttribute], { notify: false });
138+
}
139+
return DS.$q.reject(err);
140+
});
142141
}
143142
} catch (err) {
144143
deferred.reject(err);

src/datastore/async_methods/destroy.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,12 @@ function destroy(resourceName, id, options) {
9494
}
9595
DS.eject(resourceName, id);
9696
return id;
97-
}).catch(function (err) {
98-
if (options.eagerEject && item) {
99-
DS.inject(resourceName, item);
100-
}
101-
return DS.$q.reject(err);
102-
});
97+
})['catch'](function (err) {
98+
if (options.eagerEject && item) {
99+
DS.inject(resourceName, item);
100+
}
101+
return DS.$q.reject(err);
102+
});
103103
} catch (err) {
104104
deferred.reject(err);
105105
return deferred.promise;

src/datastore/sync_methods/createInstance.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ function createInstance(resourceName, attrs, options) {
8484
var item;
8585

8686
if (options.useClass) {
87-
var Func = definition[definition.class];
87+
var Func = definition[definition['class']];
8888
item = new Func();
8989
} else {
9090
item = {};

src/datastore/sync_methods/defineResource.js

+17-7
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,17 @@ var instanceMethods = [
1616
'save',
1717
'update',
1818
'destroy',
19-
'refresh'
19+
'refresh',
20+
'loadRelations',
21+
'changeHistory',
22+
'changes',
23+
'hasChanges',
24+
'lastModified',
25+
'lastSaved',
26+
'link',
27+
'linkInverse',
28+
'previous',
29+
'unlinkInverse'
2030
];
2131

2232
var methodsToProxy = [
@@ -238,13 +248,13 @@ function defineResource(definition) {
238248
});
239249

240250
// Create the wrapper class for the new resource
241-
def.class = DSUtils.pascalCase(defName);
242-
eval('function ' + def.class + '() {}');
243-
def[def.class] = eval(def.class);
251+
def['class'] = DSUtils.pascalCase(defName);
252+
eval('function ' + def['class'] + '() {}');
253+
def[def['class']] = eval(def['class']);
244254

245255
// Apply developer-defined methods
246256
if (def.methods) {
247-
DSUtils.deepMixIn(def[def.class].prototype, def.methods);
257+
DSUtils.deepMixIn(def[def['class']].prototype, def.methods);
248258
}
249259

250260
// Prepare for computed properties
@@ -276,13 +286,13 @@ function defineResource(definition) {
276286
});
277287
});
278288

279-
def[def.class].prototype.DSCompute = function () {
289+
def[def['class']].prototype.DSCompute = function () {
280290
return DS.compute(def.name, this);
281291
};
282292
}
283293

284294
DSUtils.forEach(instanceMethods, function (name) {
285-
def[def.class].prototype['DS' + DSUtils.pascalCase(name)] = function () {
295+
def[def['class']].prototype['DS' + DSUtils.pascalCase(name)] = function () {
286296
var args = Array.prototype.slice.call(arguments);
287297
args.unshift(this[def.idAttribute]);
288298
args.unshift(def.name);

src/datastore/sync_methods/inject.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ function _inject(definition, resource, attrs, options) {
8585

8686
if (definition.idAttribute in changed) {
8787
$log.error('Doh! You just changed the primary key of an object! ' +
88-
'I don\'t know how to handle this yet, so your data for the "' + definition.name +
89-
'" resource is now in an undefined (probably broken) state.');
88+
'I don\'t know how to handle this yet, so your data for the "' + definition.name +
89+
'" resource is now in an undefined (probably broken) state.');
9090
}
9191
}
9292

@@ -120,10 +120,10 @@ function _inject(definition, resource, attrs, options) {
120120

121121
if (!item) {
122122
if (options.useClass) {
123-
if (attrs instanceof definition[definition.class]) {
123+
if (attrs instanceof definition[definition['class']]) {
124124
item = attrs;
125125
} else {
126-
item = new definition[definition.class]();
126+
item = new definition[definition['class']]();
127127
}
128128
} else {
129129
item = {};

src/errors.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function IllegalArgumentError(message) {
3131
this.message = message || 'Illegal Argument!';
3232
}
3333

34-
IllegalArgumentError.prototype = Object.create(Error.prototype);
34+
IllegalArgumentError.prototype = new Error();
3535
IllegalArgumentError.prototype.constructor = IllegalArgumentError;
3636

3737
/**
@@ -67,7 +67,7 @@ function RuntimeError(message) {
6767
this.message = message || 'RuntimeError Error!';
6868
}
6969

70-
RuntimeError.prototype = Object.create(Error.prototype);
70+
RuntimeError.prototype = new Error();
7171
RuntimeError.prototype.constructor = RuntimeError;
7272

7373
/**
@@ -103,7 +103,7 @@ function NonexistentResourceError(resourceName) {
103103
this.message = (resourceName || '') + ' is not a registered resource!';
104104
}
105105

106-
NonexistentResourceError.prototype = Object.create(Error.prototype);
106+
NonexistentResourceError.prototype = new Error();
107107
NonexistentResourceError.prototype.constructor = NonexistentResourceError;
108108

109109
/**

0 commit comments

Comments
 (0)