You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently it takes a significant amount of boilerplate to inject a function that can be used to change the current theme into the widget tree:
// main.tsimportrendererfrom"@dojo/framework/widget-core/vdom";import{w}from"@dojo/framework/widget-core/d";importAppfrom"./widgets/App";import{Registry}from"@dojo/framework/widget-core/Registry";import{registerThemeInjector,Theme}from"@dojo/framework/widget-core/mixins/Themed";importmyThemefrom'./my-theme';constregistry=newRegistry();constinjector=registerThemeInjector(myTheme,registry);registry.defineInjector("update-theme",invalidator=>{functionthemeSwitcher(theme: Theme){injector.set({ theme });}return()=>themeSwitcher;});constr=renderer(()=>w(App,{}));r.mount({ registry });// ThemeSwitcherContainer.ts// Used in the application somewhere to inject the theme switcher functionimportContainerfrom"@dojo/framework/widget-core/Container";importThemeSwitcherfrom"./ThemeSwitcher";exportdefaultContainer(ThemeSwitcher,"update-theme",{getProperties(injector){return{themeSwitcher: injector};}});
It would be helpful if Dojo could provide a customised widget that injects a function that can be to switch themes into an application widget tree.
The widget should be virtual and have no visual output, but provide an API to for the user to render widgets and nodes with access to the update theme function. This would remove the need for a user to register a new injector or create a custom container to get access to the update theme function.
The text was updated successfully, but these errors were encountered:
Enhancement
Currently it takes a significant amount of boilerplate to inject a function that can be used to change the current theme into the widget tree:
It would be helpful if Dojo could provide a customised widget that injects a function that can be to switch themes into an application widget tree.
The widget should be virtual and have no visual output, but provide an API to for the user to render widgets and nodes with access to the update theme function. This would remove the need for a user to register a new injector or create a custom container to get access to the update theme function.
The text was updated successfully, but these errors were encountered: