samiskin / redux-electron-store

⎋ A redux store enhancer that allows automatic synchronization between electron processes
MIT License
375 stars 32 forks source link

Feature Request: Allow naming of source windows #13

Closed davej closed 8 years ago

davej commented 8 years ago

Currently the window source in actions are simply window x (where x is the BrowserWindow id (integer)).

What do you think of the idea of allowing redux-electron-store to accept a custom source option? It would make it easier to identify which window the action originated from.

Generally, :+1: for this lib by the way it works very well!

samiskin commented 8 years ago

Great Idea! I'll try to get to it over the next few days. Any ideas for the name of the option?

davej commented 8 years ago

I guess windowName or windowTitle or something like that. Another possibility is that you could read document.title from the DOM.

davej commented 8 years ago

Maybe have a fallback if the windowTitle (or whatever) option isn't specified. Pseudocode:

const windowSourceTitle = options.windowTitle || document.title || rendererId;

You would probably need an additional step to ensure that window source titles are unique (I guess you could just append the rendererId).

samiskin commented 8 years ago

Added in https://github.com/samiskin/redux-electron-store/pull/14 under the option sourceName and published in v0.3.5 :+1:

I decided to just leave the default as what it currently is (window x or webview x), since providing sourceName: document.title isn't much for a user to add themselves if they want it.

davej commented 8 years ago

Awesome. Thanks!