From bce50342e1caeebeadcb760503e6c4133a1dffb2 Mon Sep 17 00:00:00 2001 From: Vasyl Boroviak Date: Mon, 19 Sep 2016 11:45:05 +1000 Subject: [PATCH] Mention a workaround for the removed feature (first factory arg auto assignment). Mention thenables are not supported anymore. --- docs/API.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/API.md b/docs/API.md index b148374..b46c448 100644 --- a/docs/API.md +++ b/docs/API.md @@ -588,11 +588,21 @@ const Stamp = stampit({init(arg, {instance, stamp, args}) { Stamp({foo: 'bar'}); // {} ``` +A workaround can be implemented as a separate behavior (stamp). +```js +const AssignFirstArgument = stampit({ init(opts) { + Object.assign(this, opts); +}}); +Stamp = AssignFirstArgument.compose(Stamp); +Stamp({foo: 'bar'}); // {foo: "bar"}ß +``` + * A stamp's metadata is now stored in the `stamp.compose` object. Previously it was stored in `stamp.fixed` object. * Removed `convertConstructor()` (we plan to revive it supporting ES6 classes) * Removed `state()`. Use `props()` instead. * `stampit.mixin()`, `.extend()`, `.mixIn()`, `.assign()` are all gone too. Use `Object.assign()` * `static()` got renamed to `statics()` +* Initializers do not support Promises anymore. Meaning that "thenables" are not automatically unwrapped by initializers. **New features** * Stampit is compatible with the [Stamp Specification](https://github.com/stampit-org/stamp-specification/).