Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Commit

Permalink
feat(renderer): save current state on change (#486)
Browse files Browse the repository at this point in the history
  • Loading branch information
Palmaswell authored and marionebl committed May 30, 2018
1 parent 7cd8fe5 commit ff9f654
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/electron/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,6 @@ async function createWindow(): Promise<void> {
case ServerMessageType.Save: {
const project = Project.from(message.payload.project);
project.setPath(message.payload.path);

if (process.env.NODE_ENV === 'development') {
projectPath = project.getPath();
}
Expand Down
18 changes: 18 additions & 0 deletions src/electron/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,24 @@ Mobx.autorunAsync(() => {
});
});

Mobx.autorunAsync(() => {
const project = store.getProject();
const serializedProject = project.toJSON();

if (project) {
const payload = {
path: project.getPath(),
project: serializedProject
};

Sender.send({
id: uuid.v4(),
payload,
type: ServerMessageType.Save
});
}
});

ReactDom.render(React.createElement(App), document.getElementById('app'));

// Disable drag and drop from outside the application
Expand Down

0 comments on commit ff9f654

Please sign in to comment.