Skip to content

Commit

Permalink
add explanatory comment when emitting theme-updated event
Browse files Browse the repository at this point in the history
  • Loading branch information
Regaddi committed Jul 21, 2021
1 parent db1d0d4 commit af6ba2e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -1917,7 +1917,14 @@ export default class DailyIframe extends EventEmitter {
action: DAILY_METHOD_SET_THEME,
theme: this.properties.theme,
});
// Emit theme-updated event to callFrame
/**
* For simplicity, emitting theme-updated here rather than
* listening for it from Prebuilt & re-emitting it, since:
* - we've fully validated the theme, so there's no risk of it not being applied
* - we set `this.properties.theme` first, so in a customer's `theme-updated`
* handler, a call to `theme()` will return the latest value
* - this method is the only way `theme-updated` can change
*/
try {
this.emit(DAILY_EVENT_THEME_UPDATED, {
action: DAILY_EVENT_THEME_UPDATED,
Expand Down

0 comments on commit af6ba2e

Please sign in to comment.