canjs / can-kefir

Reflects kefir streams so they can be used many places within CanJS.
https://canjs.com/doc/can-kefir.html
MIT License
3 stars 2 forks source link

Don't have .value conflict with `value` #5

Closed justinbmeyer closed 7 years ago

justinbmeyer commented 7 years ago

If someone uses .emitterProperty() to create a property with its emitter functions attached, this messes up can-stache-key because it reads the value function (and also runs it).

We have a two main options, both require breaking changes:

Rename the virtual property

Instead of {{stream.value}} we could call this {{stream.lastValue}}

Rename the .value() method

Instead of .value() we could call it .emit() only. I prefer this solution because only the emitterProperties that can-kefir creates even have .value() functions.

justinbmeyer commented 7 years ago

Another alternative, would be to just stick on the .emmitter. So if you wanted to emit a value:

property.emitter.value(1)

But two-way bindings work directly on the property:

property.value:bind="key"

But wouldn't work on the emitter:

property.emitter.value:bind="key"
justinbmeyer commented 7 years ago

I just realized this problem also exists with .error. Now I'm more convinced we should just add on the emitter.

justinbmeyer commented 7 years ago

Another wrinkle ... it can't be the actual emitter, because that might not exist yet. Yarg!