Skip to content

Commit

Permalink
Make use of global methods on window more explicit. Add formatting to…
Browse files Browse the repository at this point in the history
… setState.
  • Loading branch information
bingenito committed Oct 31, 2018
1 parent db96d7c commit 8c77352
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Electron/electron.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,15 +190,15 @@ export class ElectronContainerWindow extends ContainerWindow {

public getState(): Promise<any> {
if (this.innerWindow && this.innerWindow.webContents) {
return this.innerWindow.webContents.executeJavaScript("getState ? getState() : undefined");
return this.innerWindow.webContents.executeJavaScript("window.getState ? window.getState() : undefined");
} else {
return Promise.resolve(undefined);
}
}

public setState(state: any): Promise<void> {
if (this.innerWindow && this.innerWindow.webContents) {
return this.innerWindow.webContents.executeJavaScript(`if (setState) setState(JSON.parse(\`${JSON.stringify(state)}\`))`);
return this.innerWindow.webContents.executeJavaScript(`if (window.setState) { window.setState(JSON.parse(\`${JSON.stringify(state)}\`)); }`);
} else {
return Promise.resolve();
}
Expand Down

0 comments on commit 8c77352

Please sign in to comment.