Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit17d8df0

Browse files
committed
Closes#227.Closes#228.Fixes#207.
Stable Version 1.3.0.
1 parent3e11ffa commit17d8df0

File tree

14 files changed

+199
-175
lines changed

14 files changed

+199
-175
lines changed

‎CHANGELOG.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
#####1.3.0 - 07 November 2014
2+
3+
######Backwards compatible API changes
4+
-#227 - Added DSDestroy and DSRefresh to instance methods
5+
-#228 - Added DS.getAll(resourceName[, ids])
6+
7+
######Backwards compatible bug fixes
8+
-#207 - digest iterations error
9+
110
#####1.2.1 - 04 November 2014
211

312
######Backwards compatible bug fixes

‎README.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ 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.2.1](https://github.com/jmdobry/angular-data/releases/tag/1.2.1)
11+
__Latest Release:__[1.3.0](https://github.com/jmdobry/angular-data/releases/tag/1.3.0)
1212

13-
Angular-data is finally 1.0.!
13+
Angular-data is finally 1.0.!
1414

1515
Angular-data 1.x will continue to see bug fixes, but all new development will be on[js-data](https://github.com/js-data/js-data) and[js-data-angular](https://github.com/jmdobry/angular-data/pull/198) (Angular-data 2.0).
1616

@@ -55,14 +55,14 @@ app.controller('postCtrl', function ($scope, $routeParams, Post, Comment) {
5555
var query= {
5656
postId:$routeParams.id
5757
};
58-
58+
5959
Post.find($routeParams.id);
6060
Comment.findAll(query);
61-
61+
6262
// My goodness this was easy
6363
Post.bindOne($scope,'post',$routeParams.id);
6464
Comment.bindAll($scope,'comments', query);
65-
65+
6666
// Long form, functionally the same as above
6767
$scope.$watch(function () {
6868
returnPost.lastModified($routeParams.id);

‎bower.json‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
"author":"Jason Dobry",
33
"name":"angular-data",
44
"description":"Data store for Angular.js.",
5-
"version":"1.2.1",
5+
"version":"1.3.0",
66
"homepage":"http://angular-data.pseudobry.com/",
77
"repository": {
88
"type":"git",
9-
"url":"git://github.com/jmdobry/angular-data.git"
9+
"url":"https://github.com/jmdobry/angular-data.git"
1010
},
1111
"main":"./dist/angular-data.min.js",
1212
"ignore": [
@@ -31,7 +31,7 @@
3131
"devDependencies": {
3232
"angular":"1.2.25",
3333
"angular-mocks":"1.2.25",
34-
"angular-cache":"3.1.1",
34+
"angular-cache":"3.2.0",
3535
"observe-js":"0.3.4",
3636
"angular-data-mocks":"1.0.0",
3737
"bootstrap":"3.2.0"

‎dist/angular-data.js‎

Lines changed: 54 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
*@author Jason Dobry <jason.dobry@gmail.com>
33
*@file angular-data.js
4-
*@version 1.2.1 - Homepage <http://angular-data.pseudobry.com/>
4+
*@version 1.3.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
*
@@ -4079,6 +4079,10 @@ function updateAll(resourceName, attrs, params, options) {
40794079
module.exports=updateAll;
40804080

40814081
},{}],67:[function(require,module,exports){
4082+
varobserve=require('../../lib/observe-js/observe-js');
4083+
4084+
vartotal=0;
4085+
40824086
functionlifecycleNoop(resourceName,attrs,cb){
40834087
cb(null,attrs);
40844088
}
@@ -4210,7 +4214,14 @@ Defaults.prototype.defaultFilter = function (collection, resourceName, params, o
42104214
if(_this.utils.isString(def)){
42114215
def=[def,'ASC'];
42124216
}elseif(!_this.utils.isArray(def)){
4213-
thrownew_this.errors.IllegalArgumentError('DS.filter(resourceName[, params][, options]): '+angular.toJson(def)+': Must be a string or an array!',{params:{'orderBy[i]':{actual:typeofdef,expected:'string|array'}}});
4217+
thrownew_this.errors.IllegalArgumentError('DS.filter(resourceName[, params][, options]): '+angular.toJson(def)+': Must be a string or an array!',{
4218+
params:{
4219+
'orderBy[i]':{
4220+
actual:typeofdef,
4221+
expected:'string|array'
4222+
}
4223+
}
4224+
});
42144225
}
42154226
filtered=_this.utils.sort(filtered,function(a,b){
42164227
varcA=a[def[0]],cB=b[def[0]];
@@ -4734,9 +4745,9 @@ function DSProvider() {
47344745
'$rootScope','$log','$q','DSHttpAdapter','DSLocalStorageAdapter','DSUtils','DSErrors',
47354746
function($rootScope,$log,$q,DSHttpAdapter,DSLocalStorageAdapter,DSUtils,DSErrors){
47364747

4737-
varsyncMethods=require('./sync_methods'),
4738-
asyncMethods=require('./async_methods'),
4739-
cache;
4748+
varsyncMethods=require('./sync_methods');
4749+
varasyncMethods=require('./async_methods');
4750+
varcache;
47404751

47414752
try{
47424753
cache=angular.injector(['angular-data.DSCacheFactory']).get('DSCacheFactory');
@@ -4846,10 +4857,7 @@ function DSProvider() {
48464857
if(typeofObject.observe!=='function'||
48474858
typeofArray.observe!=='function'){
48484859
$rootScope.$watch(function(){
4849-
// Throttle angular-data's digest loop to tenths of a second
4850-
returnnewDate().getTime()/100|0;
4851-
},function(){
4852-
DS.digest();
4860+
observe.Platform.performMicrotaskCheckpoint();
48534861
});
48544862
}
48554863

@@ -4860,7 +4868,7 @@ function DSProvider() {
48604868

48614869
module.exports=DSProvider;
48624870

4863-
},{"./async_methods":61,"./sync_methods":82}],68:[function(require,module,exports){
4871+
},{"../../lib/observe-js/observe-js":1,"./async_methods":61,"./sync_methods":82}],68:[function(require,module,exports){
48644872
functionerrorPrefix(resourceName){
48654873
return'DS.bindAll(scope, expr, '+resourceName+', params[, cb]): ';
48664874
}
@@ -5382,6 +5390,13 @@ function Resource(utils, options) {
53825390
}
53835391
}
53845392

5393+
varinstanceMethods=[
5394+
'save',
5395+
'update',
5396+
'destroy',
5397+
'refresh'
5398+
];
5399+
53855400
varmethodsToProxy=[
53865401
'bindAll',
53875402
'bindOne',
@@ -5398,6 +5413,7 @@ var methodsToProxy = [
53985413
'find',
53995414
'findAll',
54005415
'get',
5416+
'getAll',
54015417
'hasChanges',
54025418
'inject',
54035419
'lastModified',
@@ -5488,24 +5504,27 @@ function defineResource(definition) {
54885504
name:definition
54895505
};
54905506
}
5507+
5508+
vardefName=definition ?definition.name :undefined;
5509+
54915510
if(!DSUtils.isObject(definition)){
54925511
thrownewIA(errorPrefix+'definition: Must be an object!');
5493-
}elseif(!DSUtils.isString(definition.name)){
5512+
}elseif(!DSUtils.isString(defName)){
54945513
thrownewIA(errorPrefix+'definition.name: Must be a string!');
54955514
}elseif(definition.idAttribute&&!DSUtils.isString(definition.idAttribute)){
54965515
thrownewIA(errorPrefix+'definition.idAttribute: Must be a string!');
54975516
}elseif(definition.endpoint&&!DSUtils.isString(definition.endpoint)){
54985517
thrownewIA(errorPrefix+'definition.endpoint: Must be a string!');
5499-
}elseif(DS.store[definition.name]){
5500-
thrownewDS.errors.R(errorPrefix+definition.name+' is already registered!');
5518+
}elseif(DS.store[defName]){
5519+
thrownewDS.errors.R(errorPrefix+defName+' is already registered!');
55015520
}
55025521

55035522
try{
55045523
// Inherit from global defaults
55055524
Resource.prototype=DS.defaults;
5506-
definitions[definition.name]=newResource(DSUtils,definition);
5525+
definitions[defName]=newResource(DSUtils,definition);
55075526

5508-
vardef=definitions[definition.name];
5527+
vardef=definitions[defName];
55095528

55105529
// Setup nested parent configuration
55115530
if(def.relations){
@@ -5597,7 +5616,7 @@ function defineResource(definition) {
55975616
});
55985617

55995618
// Create the wrapper class for the new resource
5600-
def.class=DSUtils.pascalCase(definition.name);
5619+
def.class=DSUtils.pascalCase(defName);
56015620
eval('function '+def.class+'() {}');
56025621
def[def.class]=eval(def.class);
56035622

@@ -5640,19 +5659,14 @@ function defineResource(definition) {
56405659
};
56415660
}
56425661

5643-
def[def.class].prototype.DSUpdate=function(){
5644-
varargs=Array.prototype.slice.call(arguments);
5645-
args.unshift(this[def.idAttribute]);
5646-
args.unshift(def.name);
5647-
returnDS.update.apply(DS,args);
5648-
};
5649-
5650-
def[def.class].prototype.DSSave=function(){
5651-
varargs=Array.prototype.slice.call(arguments);
5652-
args.unshift(this[def.idAttribute]);
5653-
args.unshift(def.name);
5654-
returnDS.save.apply(DS,args);
5655-
};
5662+
DSUtils.forEach(instanceMethods,function(name){
5663+
def[def.class].prototype['DS'+DSUtils.pascalCase(name)]=function(){
5664+
varargs=Array.prototype.slice.call(arguments);
5665+
args.unshift(this[def.idAttribute]);
5666+
args.unshift(def.name);
5667+
returnDS[name].apply(DS,args);
5668+
};
5669+
});
56565670

56575671
// Initialize store data for the new resource
56585672
DS.store[def.name]={
@@ -5702,8 +5716,8 @@ function defineResource(definition) {
57025716
returndef;
57035717
}catch(err){
57045718
DS.$log.error(err);
5705-
deletedefinitions[definition.name];
5706-
deleteDS.store[definition.name];
5719+
deletedefinitions[defName];
5720+
deleteDS.store[defName];
57075721
throwerr;
57085722
}
57095723
}
@@ -6136,7 +6150,7 @@ function errorPrefix(resourceName) {
61366150
*@id DS.sync methods:getAll
61376151
*@name getAll
61386152
*@description
6139-
* Synchronously return all of the resource.
6153+
* Synchronously return allitemsof thegivenresource, or optionally, a subset based on the given primary keys.
61406154
*
61416155
* ## Signature:
61426156
* ```js
@@ -6155,27 +6169,27 @@ function errorPrefix(resourceName) {
61556169
* - `{NonexistentResourceError}`
61566170
*
61576171
*@param {string} resourceName The resource type, e.g. 'user', 'comment', etc.
6158-
*@param {array} ids Optional list of primary keys to filter thearray ofresults by.
6172+
*@param {array} ids Optional list of primary keysby whichto filter the results.
61596173
*
61606174
*@returns {array} The items of the type specified by `resourceName`.
61616175
*/
61626176
functiongetAll(resourceName,ids){
6163-
varDS=this;
6177+
varDS=this;
61646178
varIA=DS.errors.IA;
6165-
varresource;
6179+
varresource=DS.store[resourceName];
61666180
varcollection=[];
61676181

61686182
if(!DS.definitions[resourceName]){
61696183
thrownewDS.errors.NER(errorPrefix(resourceName)+resourceName);
6170-
}elseif(arguments.length===2&&!DS.utils.isArray(ids)){
6184+
}elseif(ids&&!DS.utils.isArray(ids)){
61716185
thrownewIA(errorPrefix(resourceName,ids)+'ids: Must be an array!');
61726186
}
61736187

6174-
resource=DS.store[resourceName];
6175-
61766188
if(DS.utils.isArray(ids)){
61776189
for(vari=0;i<ids.length;i++){
6178-
collection.push(resource.index.get(ids[i]));
6190+
if(resource.index.get(ids[i])){
6191+
collection.push(resource.index.get(ids[i]));
6192+
}
61796193
}
61806194
}else{
61816195
collection=resource.collection.slice();
@@ -6185,6 +6199,7 @@ function getAll(resourceName, ids) {
61856199
}
61866200

61876201
module.exports=getAll;
6202+
61886203
},{}],81:[function(require,module,exports){
61896204
functionerrorPrefix(resourceName,id){
61906205
return'DS.hasChanges('+resourceName+', '+id+'): ';

‎dist/angular-data.min.js‎

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎guide/nav.html‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
<iclass="icon-wrench icon-white"></i> API<bclass="caret"></b>
8383
</a>
8484
<ulclass="dropdown-menu">
85-
<liclass="nav-header">Angular-data - 1.2.0</li>
85+
<liclass="nav-header">Angular-data - 1.3.0</li>
8686
<li>
8787
<ahref="/documentation/api/angular-data/angular-data">Overview</a>
8888
</li>
@@ -107,7 +107,7 @@
107107
<ahref="/documentation/api/angular-data-mocks/DSHttpAdapter">DSHttpAdapter</a>
108108
</li>
109109
<liclass="divider"></li>
110-
<liclass="nav-header">Angular-cache - 3.1.1</li>
110+
<liclass="nav-header">Angular-cache - 3.2.0</li>
111111
<li>
112112
<ahref="/documentation/api/angular-cache/angular-cache">Overview</a>
113113
</li>

‎karma.conf.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ module.exports = function (config) {
1616
'karma-spec-reporter'
1717
],
1818
autoWatch:false,
19+
browserNoActivityTimeout:30000,
1920
browsers:['Chrome'],
2021

2122
// list of files / patterns to load in the browser

‎package.json‎

Lines changed: 4 additions & 4 deletions
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.2.1",
4+
"version":"1.3.0",
55
"homepage":"http://angular-data.pseudobry.com",
66
"repository": {
77
"type":"git",
@@ -20,10 +20,10 @@
2020
],
2121
"devDependencies": {
2222
"grunt":"0.4.5",
23-
"grunt-browserify":"3.0.1",
23+
"grunt-browserify":"3.2.0",
2424
"grunt-contrib-clean":"0.6.0",
2525
"grunt-contrib-concat":"0.5.0",
26-
"grunt-contrib-copy":"0.6.0",
26+
"grunt-contrib-copy":"0.7.0",
2727
"grunt-contrib-jshint":"0.10.0",
2828
"grunt-contrib-uglify":"0.6.0",
2929
"grunt-contrib-watch":"0.6.1",
@@ -40,7 +40,7 @@
4040
"karma-sinon":"1.0.3",
4141
"karma-spec-reporter":"0.0.13",
4242
"time-grunt":"1.0.0",
43-
"jit-grunt":"0.8.0",
43+
"jit-grunt":"0.9.0",
4444
"grunt-docular":"0.1.4"
4545
},
4646
"scripts": {

‎src/datastore/index.js‎

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
varobserve=require('../../lib/observe-js/observe-js');
2+
3+
vartotal=0;
4+
15
functionlifecycleNoop(resourceName,attrs,cb){
26
cb(null,attrs);
37
}
@@ -129,7 +133,14 @@ Defaults.prototype.defaultFilter = function (collection, resourceName, params, o
129133
if(_this.utils.isString(def)){
130134
def=[def,'ASC'];
131135
}elseif(!_this.utils.isArray(def)){
132-
thrownew_this.errors.IllegalArgumentError('DS.filter(resourceName[, params][, options]): '+angular.toJson(def)+': Must be a string or an array!',{params:{'orderBy[i]':{actual:typeofdef,expected:'string|array'}}});
136+
thrownew_this.errors.IllegalArgumentError('DS.filter(resourceName[, params][, options]): '+angular.toJson(def)+': Must be a string or an array!',{
137+
params:{
138+
'orderBy[i]':{
139+
actual:typeofdef,
140+
expected:'string|array'
141+
}
142+
}
143+
});
133144
}
134145
filtered=_this.utils.sort(filtered,function(a,b){
135146
varcA=a[def[0]],cB=b[def[0]];
@@ -653,9 +664,9 @@ function DSProvider() {
653664
'$rootScope','$log','$q','DSHttpAdapter','DSLocalStorageAdapter','DSUtils','DSErrors',
654665
function($rootScope,$log,$q,DSHttpAdapter,DSLocalStorageAdapter,DSUtils,DSErrors){
655666

656-
varsyncMethods=require('./sync_methods'),
657-
asyncMethods=require('./async_methods'),
658-
cache;
667+
varsyncMethods=require('./sync_methods');
668+
varasyncMethods=require('./async_methods');
669+
varcache;
659670

660671
try{
661672
cache=angular.injector(['angular-data.DSCacheFactory']).get('DSCacheFactory');
@@ -765,10 +776,7 @@ function DSProvider() {
765776
if(typeofObject.observe!=='function'||
766777
typeofArray.observe!=='function'){
767778
$rootScope.$watch(function(){
768-
// Throttle angular-data's digest loop to tenths of a second
769-
returnnewDate().getTime()/100|0;
770-
},function(){
771-
DS.digest();
779+
observe.Platform.performMicrotaskCheckpoint();
772780
});
773781
}
774782

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp