Closed christopherjbaker closed 4 years ago
Ah, I missed the part where you left them in. Lets brainstorm a bit on these names. One problem with resolveBy
and getAsync
is they both are really resolved by calling resolve
. Why aren't they both called resolveBy
? The difference is that:
getAsync
will form a "compute" around the function, implicitly binding on all read observables (And I think you made it take promises too)resolveBy
you have to do the binding yourself@chasenlehara and @phillipskevin should be involved in this because can-value
will likely have these methods too, we should try to be consistent everywhere. Relevant issue:
https://github.com/canjs/can-value/issues/5
Some options:
value.get()
value.returnedBy()
value.compute()
value.getAsync()
value.asyncGet()
value.asyncResolve()
value.resolveAsync()
value.resolvedBy()
, value.resolvedWith()
Best might be:
value.returnedBy()
value.resolveAsync()
value.resolvedBy()
idk ... I'm very open to suggestions ...
Another:
value.compute( handler() )
value.asyncCompute( handler(resolve) )
value.resolve( handler( {listenTo, lastSet, resolve, stopListening} ) )
I don’t feel strongly about this, but I would lean toward what Justin’s proposing, with the exception that I would call it either resolvedByAsync
or resolvedAsync
.
Is this accurate:
basic getter: is analogous to a synchronous get async getter: is analogous to an asynchronous get, like 1 promise, 1 value to return binder: is analogous to a stream, from 1 dependancy change could produce 0 - many values
If this is accurate I like:
value.get()
value.getAsync()
value.resolvedBy()
Both of the originals were left in and deprecated
I changed
async
because its present form cannot be imported as a named import, due to the new-ish async functions. I have no connection togetAsync
, I just figured this was a good time to change it as we were changing the other.