Skip to content

Instantly share code, notes, and snippets.

@dcleao
Last active November 15, 2015 18:04
Show Gist options
  • Select an option

  • Save dcleao/dbe9cd3795d5db55a4d5 to your computer and use it in GitHub Desktop.

Select an option

Save dcleao/dbe9cd3795d5db55a4d5 to your computer and use it in GitHub Desktop.
JSON-Type
// custom JS function serialization/deserialization
// custom date, iso format
// special numbers: +/- Infinity
// undefined value
// ---
// A way to pass more data types through JSON.
// A way to be able to use JSONObject in Java.
// A way of de-serializing without additional metadata.
// A way that can be used with JSON.stringify and JSON.parse.
({
foo: {":": "js/fun", "v": "function() {\n return \"foo\";\n}"},
bar: {":": "date", "v": "2009-08-24T07:30:00Z"},
guu: {":": "number", "v": "Infinity"},
und: {":": "undef"},
// TODO: AMD module class/factory? => async load... => not a good reviver...
// 2 passes? one for collecting dependencies other for resolving?
// Temptatively sync signature. Fails if some module is not already loaded.
// Async signature.
// new Guu(revivedSpec);
dah: {":": "amd:foo/bar/guu", customprop: "", otherprop: ""}
})
@dcleao
Copy link
Author

dcleao commented Nov 15, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment