Skip to content
This repository was archived by the owner on Aug 18, 2018. It is now read-only.

Commit e9747bc

Browse files
committed
parseToServer is optional now
1 parent 61a5aef commit e9747bc

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

src/library/interfaces/service.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ export interface IService {
1515
cachememory: ICacheMemory;
1616
cachestore: ICacheStore;
1717
parseFromServer(attributes: IAttributes): void;
18-
parseToServer(attributes: IAttributes): void;
18+
parseToServer?(attributes: IAttributes): void;
1919
}

src/library/resource.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,14 @@ export class Resource extends ParentResourceService implements IResource {
8484
}
8585
});
8686

87-
let attributes = angular.copy(this.attributes);
88-
this.getService().parseToServer(attributes);
87+
// just for performance dont copy if not necessary
88+
let attributes;
89+
if (this.getService().parseToServer) {
90+
attributes = angular.copy(this.attributes);
91+
this.getService().parseToServer(attributes);
92+
} else {
93+
attributes = this.attributes;
94+
}
8995

9096
let ret: IDataObject = {
9197
data: {

src/library/service.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ export class Service extends ParentResourceService implements IService {
151151
let paramsurl = new UrlParamsBuilder();
152152
path.applyParams(this, params);
153153
if (params.remotefilter && Object.keys(params.remotefilter).length > 0) {
154-
this.getService().parseToServer(params.remotefilter);
154+
this.getService().parseToServer ? this.getService().parseToServer(params.remotefilter) : null;
155155
path.addParam(paramsurl.toparams( { filter: params.remotefilter } ));
156156
}
157157
if (params.page) {
@@ -300,8 +300,4 @@ export class Service extends ParentResourceService implements IService {
300300
public parseFromServer(attributes: IAttributes): void {
301301

302302
}
303-
304-
public parseToServer(attributes: IAttributes): void {
305-
306-
}
307303
}

0 commit comments

Comments
 (0)