Skip to content
This repository has been archived by the owner on Jun 3, 2022. It is now read-only.

Commit

Permalink
Requires remote to be initialized when checking if enabled.
Browse files Browse the repository at this point in the history
  • Loading branch information
chriscox committed Mar 24, 2017
1 parent 1173b21 commit 6612a2f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/lib/Remote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export class Remote {
* @return {boolean}
*/
get isEnabled(): boolean {
return this._enabled;
return this._initialized && this._enabled;
}

private _remoteId: string;
Expand Down Expand Up @@ -201,7 +201,7 @@ export class Remote {
* @param {boolean = true} Whether to throttle the saves.
*/
static saveVariable(variable: Variable, throttle: boolean = true): void {
if (this._sharedInstance._enabled) {
if (this._sharedInstance.isEnabled) {
if (throttle) {
this._sharedInstance._throttledSaveVariable(variable);
} else {
Expand All @@ -215,7 +215,7 @@ export class Remote {
* @static
*/
static removeAllVariables(): void {
if (this._sharedInstance._enabled) {
if (this._sharedInstance.isEnabled) {
this._sharedInstance.dbReference().remove();
}
}
Expand All @@ -229,7 +229,7 @@ export class Remote {
* @param {Variable} variable The variable to save.
*/
private _save(variable: Variable): void {
if (this._enabled) {
if (this.isEnabled) {
this.stopObservingUpdates(variable.key);
this.dbReference().child(variable.key).set(variable.serialize());
this.startObservingUpdates(variable.key);
Expand Down

0 comments on commit 6612a2f

Please sign in to comment.