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 marko-widgets allows to define a UI component's renderer as require('marko-widgets').defineRenderer({...});. I would like to propose a similar, but simpler:
require('marko').defineRenderer({...});
Context
Building our project, we've defined custom taglibs that export the simplest "components" to more complex components. For simple componets (server-rendered only, no state, little to no client behavior), our approach to custom taglibs has been to export in index.js a function that takes an input and then calls template.render.
Unlike defineRenderer, this does not export a render function similar to defineRenderer. We could set exports.render or use createRenderFunc from raptor-renderer, however I would like to propose a defineRenderer in marko, with similar (but much simpler) life cycle events.
The added benefit (and why this beats exports.render or createRenderFunc) is that if the simple component takes on a more, complex role, adding -widgets + any extra lifecycle event methods is straightforward and painless.
Thanks!
The text was updated successfully, but these errors were encountered:
NOTE: defineRenderer should be required as a sub-module (require('marko/defineRenderer')). This was done to avoid adding any extra weight to the main marko runtime.
Description
Currently marko-widgets allows to define a UI component's renderer as
require('marko-widgets').defineRenderer({...});
. I would like to propose a similar, but simpler:require('marko').defineRenderer({...});
Context
Building our project, we've defined custom taglibs that export the simplest "components" to more complex components. For simple componets (server-rendered only, no state, little to no client behavior), our approach to custom taglibs has been to export in index.js a function that takes an
input
and then calls template.render.Unlike defineRenderer, this does not export a
render
function similar to defineRenderer. We could setexports.render
or usecreateRenderFunc
fromraptor-renderer
, however I would like to propose adefineRenderer
inmarko
, with similar (but much simpler) life cycle events.The added benefit (and why this beats
exports.render
orcreateRenderFunc
) is that if the simple component takes on a more, complex role, adding-widgets
+ any extra lifecycle event methods is straightforward and painless.Thanks!
The text was updated successfully, but these errors were encountered: