Skip to content

Commit

Permalink
feat(loading): delete restore properties unnecessary
Browse files Browse the repository at this point in the history
  • Loading branch information
ramonornela committed Dec 11, 2016
1 parent 41d73b4 commit 9324128
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/providers/loading-ionic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ export class LoadingIonicPlugin extends PluginBase implements PreRequestPlugin,

protected loadingOptions: Object = {};

protected originalLoadingOptions: Object;

protected presentLoading: boolean = false;

constructor(private loadingController: LoadingController) {
Expand All @@ -32,8 +30,6 @@ export class LoadingIonicPlugin extends PluginBase implements PreRequestPlugin,
}

preRequest() {
this.originalLoadingOptions = Object.assign({}, this.loadingOptions);

if (this.skippedCount) {
if (this.allow && !this.presentLoading) {
this.presentLoading = true;
Expand All @@ -60,24 +56,23 @@ export class LoadingIonicPlugin extends PluginBase implements PreRequestPlugin,
this.loading.dismissAll();
}

// reset values
this.loading = null;
this.loadingOptions = this.originalLoadingOptions;
this.allow = true;

this.restoreOptions();
}

postRequest() {
if (this.loading !== null && this.skippedCount === null) {
this.dismiss();
}

this.restoreOptions();
}

postRequestError() {
if (this.loading !== null) {
this.dismiss();
}

this.restoreOptions();
}

disableLoading(skip?: boolean | number): this {
Expand Down

0 comments on commit 9324128

Please sign in to comment.