Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ As with `encapsulate` but automatically throws upon obtaining a `TypesonPromise`

#### `encapsulateAsync` (obj, [opts])

As with `encapsulate` but automatically throws upon obtaining a non-`TypesonPromise` return result from the replacer (as only a `Typeson-Promise` is expected for asynchronous types).
As with `encapsulate` but automatically throws upon obtaining a non-`TypesonPromise` return result from the replacer (as only a `TypesonPromise` is expected for asynchronous types).

##### Sample

Expand Down Expand Up @@ -605,7 +605,7 @@ reconstructed).
#### `TypesonPromise` class

If you have a type which you wish to have resolved asynchronously, you
can can return a `Typeson.Promise` (which works otherwise like a `Promise`)
can can return a `TypesonPromise` (which works otherwise like a `Promise`)
and call its first supplied argument (`resolve`) when ready.

The reason we expect this class to be used here instead of regular `Promise`s
Expand All @@ -626,7 +626,7 @@ const typeson = new Typeson({sync: false}).register({
return x instanceof MyAsync;
},
function (o) {
return new Typeson.Promise(function (resolve, reject) {
return new TypesonPromise(function (resolve, reject) {
setTimeout(function () {
// Do something more useful in real code
if (Date.now() % 2) {
Expand Down
Loading