-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GRAFX-3507 Support multiple event handlers #482
base: main
Are you sure you want to change the base?
Conversation
Coverage ReportCoverage report can be checked at https://stgrafxstudiodevpublic.blob.core.windows.net/sdk/coverage/482/coverage.html Use PR sdk packageTarball can be downloaded from https://stgrafxstudiodevpublic.blob.core.windows.net/sdk/dev-packages/482/studio-sdk.tgz To use in local project, change package.json to use local tarball "dependencies": {
"@chili-publish/studio-sdk": "https://stgrafxstudiodevpublic.blob.core.windows.net/sdk/dev-packages/482/studio-sdk.tgz"
} |
…n` for callback arguments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this idea 💯
I do have some concerns regarding the naming.
* Introduce Logger in ConfigType * Add Error Behaviors to callback execution
…pes.ts and ConfigHelper.ts
After receiving feedback from @Matthiee and discussing offline with @brapoprod :
|
Problem
When using the SDK, we expose a lot of event handlers to the integrator. For example, we can execute a callback whenever the selected frame changed. There is one big (not obvious) caveat, the handler can only be defined once. This means that each event can only be handled by 1 consumer. This is especially bad when using studio-ui, and you want to tap into some of these event yourself as integrator. Once you do that, you probably have broken the studio-ui interface by overriding it’s subscription.
Proposal
Code Highlights
ConfigType
does not includeevents
property). Although the SDK constructor starts with wrapping this config object to aRuntimeConfigType
which adds the events. https://github.com/chili-publish/studio-sdk/pull/482/files#diff-04689b788dad65b6ce4b43e7344d3b854b1a95ad2c8692c6ece28ccd7d9a96b4R93EventHelper.ensureSubscriptions
=> this wraps theConfigType
to aRuntimeConfigType
, automatically registering the legacy handlers already defined inConfigType
. https://github.com/chili-publish/studio-sdk/pull/482/files#diff-8cc56e41f48f0a52e82e4c279dba504747c37e1c76bf0d79b802505878eb56a7R69EventSubscription
=> controls the multiple callbacks (both registering and execution) https://github.com/chili-publish/studio-sdk/pull/482/files#diff-8cc56e41f48f0a52e82e4c279dba504747c37e1c76bf0d79b802505878eb56a7R23Open Questions
SDK.config.events
or are there better naming options?SDK.config.handlers
to indicate callbacks that require to return a result