12-24-2017 16:08
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


12-24-2017 16:08
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
This is probably a dumb question, but is there an elegant way to call a function in companion/index.js in response to an event (eg, button onclick) in settings/index.jsx? I can get the companion to respond to changes in settings, but I'd like to be able to get the companion to respond to event handlers.
Gondwana Software
01-07-2018 08:27 - edited 01-07-2018 08:27
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

01-07-2018 08:27 - edited 01-07-2018 08:27
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Did you figure this out? I am trying to do this as well.

01-07-2018 11:29
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


01-07-2018 11:29
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Not exactly, but I came up with a kludge that seems to work. In index.jsx:
<Button label="Create/Update" onClick={() => { props.settingsStorage.setItem('createAccount', 'true'); }} />
In companion/index.js:
if (me.launchReasons.settingsChanged) { let createAccountSetting = settingsStorage.getItem('createAccount'); if (createAccountSetting === 'true') createAccount(); }
settingsStorage.onchange = function(evt) { if (evt.key === "createAccount" && evt.newValue === "true") createAccount(); }
Gondwana Software

