promise icon indicating copy to clipboard operation
promise copied to clipboard

Name of "when"

Open kelunik opened this issue 8 years ago • 0 comments

I'm more and more thinking the method shouldn't be named when. It doesn't really matter for promise implementations with just that method such as Amp's Deferred / Placeholder, but it certainly matters if you have other methods as well.

React is one library providing further methods, but those are strictly about the core nature of a promise, getting the value or reason out. It's more problematic if a promise is more than a simple placeholder, such as Amp\Message or Aerys\BodyParser. Those implement Promise to provide a mechanism to consume the complete result easily, while at the same time allowing the consumption of intermediate results.

Currently I can offer the following suggestions: onResolve, onComplete.

Maybe this also helps differentiating between when and then, as they're quite similar currently.

kelunik avatar Mar 08 '17 08:03 kelunik