Skip to content
This repository has been archived by the owner on Sep 7, 2022. It is now read-only.

Element request: iron-serialize-remote & iron-serialize #52

Open
anirudhb opened this issue Apr 20, 2018 · 0 comments
Open

Element request: iron-serialize-remote & iron-serialize #52

anirudhb opened this issue Apr 20, 2018 · 0 comments

Comments

@anirudhb
Copy link

anirudhb commented Apr 20, 2018

Description

iron-serialize and iron-serialize-remote should be flexible, multi-use, serialization elements.

iron-serialize

iron-serialize should be a serialization/deserialization element. It should support all major data serialization formats, like XML, YAML, JSON, TOML, etc.

Example:

<!-- Note: 'yml' should also be considered YAML -->
<iron-serialize auto target="{{raw_obj}}" format="yaml" text="{{raw_yaml_text}}"></iron-serialize>
<!--
If raw_yaml_text is:
awesome: true
stuff:
  - one
  - two
  - three
Then raw_obj should be:
{
  awesome: true,
  stuff: ["one", "two", "three"]
}
-->

If the target object or the text changes, the other should be updated to reflect the changes. (Only if there is auto attribute. Use generateChanges to change manually.)
Event for changing: change

iron-serialize-remote

iron-serialize-remote is just like iron-serialize, except it can serialize from a file (fetched with AJAX.)
Catch: it cannot update the file if the target object changes. However, you should be able to register a callback which might save the text somewhere else.

This would also pass on the auto attribute to its internal iron-serialize.

In fact, this would be a very rough implementation:

<iron-ajax auto url="{{file}}" handle-as="text" last-response="{{_t1}}"></iron-ajax>
<iron-serialize auto target="{{obj}}" format="json" text="[[_t1]]"></iron-serialize>

Event for changing: change

Edit: Is iron-serialize-remote really needed?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant