Skip to content

Commit

Permalink
Propagate configuraiton mode to all outlets
Browse files Browse the repository at this point in the history
  • Loading branch information
Sébastien Barbier committed Apr 17, 2020
1 parent 628216e commit 9ca492d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

- New `OutletsDeleteAssignmentRequest` and `OutletsDeleteAssignmentResponse` models for messages
- Propagate `SHELL_EVENTS.Version1.OUTLET.REQUEST_CONTEXT` to all outlets if only update configurationmode state

## [1.2.0] - 2020-03-31

Expand Down
12 changes: 12 additions & 0 deletions src/ShellSdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,18 @@ export class ShellSdk {
return;
}

// If ShellSdk receive OUTLET.REQUEST_CONTEXT with only `isConfigurationMode` we propagate to all outlets
if (payload.type == SHELL_EVENTS.Version1.OUTLET.REQUEST_CONTEXT &&
payload.value.hasOwnProperty('isConfigurationMode') &&
!payload.value.hasOwnProperty('target') &&
!payload.value.hasOwnProperty('plugin')) {
this.outletsMap.forEach((value, key) => {
if (key.contentWindow) {
key.contentWindow.postMessage({ type: payload.type, value: payload.value }, this.origin);
}
});
}

// Message has a `to` value, send to an outlet as one to one communication
if (payload.to && payload.to.length != 0 && payload.type !== SHELL_EVENTS.Version1.TO_APP) {
this.debugger.traceEvent('outgoing', payload.type, payload.value, { to: payload.to }, true);
Expand Down

0 comments on commit 9ca492d

Please sign in to comment.