-
-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feature] lifecycle handlers for advanced deserialization and error h…
…andling (#90) * added propSchema customAsync. It allows asynchronous custom property deserialization. Especially, it allows to wait for resolution of references inside custom properties. * added propSchema customAsync. It allows asynchronous custom property deserialization. Especially, it allows to wait for resolution of references inside custom properties. * added test coverage for custom and customAsync propSchema * added optional callback to custom propScheme * removed customAsync, custom deserializer with callback should be used * fix * final polish, removed build error * set version to 1.2.0 * added support for lifecycle methods in deserialization * added cancelDeserialize and atomic livecycle methods for deserialization * don't test mapAsArray for lifeCycle handlers * fix Object.entries not available in node 6 * fix mapAsArray to always create map objects for uninitialized values * fix package json (remove editor specific param) * fix mapAsArray to always push elements to serialized array * updated documentation * Update tsconfig.json * Update README.md
- Loading branch information
1 parent
c85a637
commit e46f798
Showing
23 changed files
with
855 additions
and
196 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,4 +57,4 @@ | |
"typescript": "^2.1.4", | ||
"uglify-js": "^2.6.4" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* | ||
* Deserialization | ||
*/ | ||
import { invariant } from "../utils/utils" | ||
import { getTargetContext } from "./Context" | ||
|
||
|
||
/** | ||
* Cancels an asynchronous deserialization or update operation for the specified target object. | ||
* @param instance object that was previously returned from deserialize or update method | ||
*/ | ||
export default function cancelDeserialize(instance) { | ||
invariant(typeof instance === "object" && instance && !Array.isArray(instance), "cancelDeserialize needs an object") | ||
var context = getTargetContext(instance) | ||
if (context) { | ||
context.cancelAwaits() | ||
} | ||
} |
Oops, something went wrong.