braindump: rerenderables
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 2.9k
- Forks
- 461
- PR merge metrics
- No merged PRs in 30d
Description
@jimmyhchan talked about this last year and I think it finally clicked for me.
`dust.render` returns undefined right now and uses a callback. Jimmy talked about "streaming into templates" last year and I never quite grokked it, but I think this might be it.
What about an API something like this:
```
let renderable = dust.render(template, context, function(err, out) {
// some side effect, appending to or replacing DOM or whatever
});
renderable.render(anotherContext); // uses the same template and the same callback
someStream.pipe(renderable); // maybe this invokes the callback once for every data event
```
This would give you a `renderable` that you could store and reuse to update a certain portion of DOM with new data. Identifying when data changed would still be your responsibility, this is just so you don't have to manually wire it all up again.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the existing dust.render API and its callback behavior. Clarify the reusable renderable and stream semantics before implementation, including how repeated renders invoke the callback. Done should include an agreed API and tests covering the proposed usage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100