In pairing with folks, resourceFactory is juuust clunky enough to create a knowledge cliff in learning resources
For clarification this is the removal of resourceFactory in
const Timer = resourceFactory(updateMs => {
return resource(() => {
setInterval(() => { /* ... */ }, updateMs);
});
});
and enabling this
function Timer(updateMs) {
return resource(() => {
setInterval(() => { /* ... */ }, updateMs);
});
}
This has the benefit of:
- being one less abstraction
- enabling generics in TS
Sample babel Plugin: https://astexplorer.net/#/gist/1833c986a7167eba0875eaf100a11adb/fb2cb060d563818908747ea2959886c837988759
Options:
- Babel plugin
- how do we support both modifiers
- won't work with TS without integrating with Glint
- and non-modifiers?
- Opt-in re-registration of "default" managers