tildeio / htmlbars

A variant of Handlebars that emits DOM and allows you to write helpers that manipulate live DOM nodes
MIT License
1.6k stars 193 forks source link

Helper streams require get #358

Closed mixonic closed 9 years ago

mixonic commented 9 years ago

If invokeHelper is to return a stream, we must ensure that stream always has a value generated. Sometimes a stream's compute function may yield a block instead of generate a value.

This forces compute to happen once.

There is probably a better way to achieve the base goal here. For example, I should likely only link nodes that a new-style Ember.Helper, where they cannot interact with yield etc.

See also: https://github.com/mixonic/ember.js/pull/8

mmun commented 9 years ago

LGTM (except the continueBlock stuff I am not familiar with)

mixonic commented 9 years ago

Cleaned this up to only call the value hook when the value is used. Ensuring that a helper using internals (yielding blocks etc) will be run is the responsibility of invokeHelper in Ember.