-
Notifications
You must be signed in to change notification settings - Fork 60
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
draft proposal: new extension points system #2032
Comments
might streamline the use case talked about in #2006 |
I had another idea for extending plugins. It's more similar to the autorun solution we have for plugins adding custom right click menu options here: jbrowse-components/plugins/dotplot-view/src/index.ts Lines 353 to 364 in d351318
The idea is that instead of having to have export default class DisplayType extends PluggableElementBase {
// the stuff that's already in DisplayType...
extendStateModel(extension) {
this.stateModel = this.stateModel.extend(extension)
}
} And then in the plugin's class SomePlugin extends Plugin {
configure(pluginManager) {
const displayType = pluginManager.getDisplayType('LinearAlignmentsDisplay')
displayType.extendStateModel(self => {
const superContextMenuItems = self.contextMenuItems
return {
views: {
contextMenuItems() {
const menuItems = superContextMenuItems()
menuItems.push(/* new menu items here */)
return menuItems
},
},
actions: {
// could add actions, too
},
}
})
}
} This is a bit less general than the generic extension points, since you can only extend things in a plugin's stateModel, but I think addresses the use cases we've talked about so far. |
that's a neat idea. it's nice that it doesn't really introduce any new architecture. |
that could be ok. I tried using both extend and just compose and it appeared to operate similarly...continuing on my testing codesandbox from mobx-state-tree https://codesandbox.io/s/blue-dawn-wrgvj?file=/src/App.js |
we may have to think about what things need to be changed into functions to make this work.. I envision renderProps may also need to change to a function, and really it sort of boils down to anything we forsee being derived... |
The text was updated successfully, but these errors were encountered: