You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this API, you don't even need defaultWidth|defaultHeight options, since they can be defined in windowProps, and will be overridden by recalled state if present.
By support assignment I mean:
Construct the state object so its enumerable properties match BrowserWindow options.
Describe methods and other proprietary stuff as non-enumerable so they don't pollute the BrowserWindow options object.
This would be the proposal with no magic and the lowest API surface I can think of. If you want to keep your proprietary props and methods, and don't like the non-enumerable treatment, a different approach might be a method that does this:
Or even better, an API that would also eliminate the need for #manage(win):
win=windowFromState(props);// BrowserWindow instance created by state keeper
props in here would be a combination of your options and BrowserWindow options. Your options would be consumed and deleted from this object, which would then be extended with recalled state, and passed to new BrowserWindow() on creation.
Just make sure to fire stuff like win.maximize() on next tick to give us time to bind listeners.
The text was updated successfully, but these errors were encountered:
Currently we have to do a lot of boilerplate:
Why not just make the returned state object support object assignment so it can seamlessly blend with the
BrowserWindow
options? Then we can just:In this API, you don't even need
defaultWidth|defaultHeight
options, since they can be defined inwindowProps
, and will be overridden by recalled state if present.By support assignment I mean:
BrowserWindow
options.BrowserWindow
options object.This would be the proposal with no magic and the lowest API surface I can think of. If you want to keep your proprietary props and methods, and don't like the non-enumerable treatment, a different approach might be a method that does this:
Or even better, an API that would also eliminate the need for
#manage(win)
:props
in here would be a combination of your options andBrowserWindow
options. Your options would be consumed and deleted from this object, which would then be extended with recalled state, and passed tonew BrowserWindow()
on creation.Just make sure to fire stuff like
win.maximize()
on next tick to give us time to bind listeners.The text was updated successfully, but these errors were encountered: