Closed oliverfoster closed 4 years ago
In some places in Adapt we inject DOM elements from one extension into another. This practise isn't possible with frameworks like VueJS and React. We need to allow instantiation of registered 'component style' views in Adapt.
VueJS: https://vuejs.org/v2/guide/components-registration.html React: https://reactjs.org/docs/components-and-props.html#composing-components
This should allow us to move to a more appropriate style of injection, ready for future frameworks, without changing too much.
Pass the Adapt model by id.
{{subview name="menu:progress" id=this._id}}
Create a model from the data specified.
{{subview name="component:completionIndicator" model=this}}
var MenuProgress = Backbone.View.extend({ initialize: function() { } }); Adapt.subviews.register("menu:progress", MenuProgress);
When it comes time to pick a framework it may be worth looking here for pros and cons https://custom-elements-everywhere.com/
Subject of the enhancement
In some places in Adapt we inject DOM elements from one extension into another. This practise isn't possible with frameworks like VueJS and React. We need to allow instantiation of registered 'component style' views in Adapt.
External examples
VueJS: https://vuejs.org/v2/guide/components-registration.html React: https://reactjs.org/docs/components-and-props.html#composing-components
Expected outcome
This should allow us to move to a more appropriate style of injection, ready for future frameworks, without changing too much.
Suggested implementation
Handlebars
Pass the Adapt model by id.
Create a model from the data specified.
JavaScript