Skip to content

Commit

Permalink
Merge pull request #49 from bampakoa/win-options
Browse files Browse the repository at this point in the history
Handle window options passed in an immutable manner
  • Loading branch information
rhysd committed Nov 3, 2019
2 parents 3655b45 + 1224501 commit 7fa12ca
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
19 changes: 19 additions & 0 deletions example/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,20 @@ app.once('ready', function() {
});
w.loadURL('file://' + join(__dirname, 'index.html'));

const options = {
icon_path: join(__dirname, 'icon.png'),
copyright: 'Copyright (c) 2015 rhysd',
package_json_dir: __dirname,
win_options: {
resizable: false,
minimizable: false,
maximizable: false,
movable: false,
parent: w,
modal: true,
}
}

const menu = Menu.buildFromTemplate([
{
label: 'Example',
Expand Down Expand Up @@ -46,6 +60,11 @@ app.once('ready', function() {
show_close_button: "Close"
}),
},
{
label: 'About This App (modal with options)',
click: () =>
openAboutWindow(options),
},
],
},
]);
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ function normalizeParam(info_or_img_path: AboutWindowInfo | string | undefined |
"First parameter of openAboutWindow() must have key 'icon_path'. Please see the document: https://github.com/rhysd/electron-about-window/blob/master/README.md",
);
}
return info;
return { ...info };
}
}

Expand Down

0 comments on commit 7fa12ca

Please sign in to comment.