Skip to content

Element for creating and accessing self-organizing meta-databases

Notifications You must be signed in to change notification settings

tommycli/iron-meta

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

79 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

Demo and API Docs

##<iron-meta>

iron-meta is a generic element you can use for sharing information across the DOM tree. It uses monostate pattern such that any instance of iron-meta has access to the shared information. You can use iron-meta to share whatever you want (or create an extension [like x-meta] for enhancements).

The iron-meta instances containing your actual data can be loaded in an import, or constructed in any way you see fit. The only requirement is that you create them before you try to access them.

Examples:

If I create an instance like this:

<iron-meta key="info" value="foo/bar"></iron-meta>

Note that value="foo/bar" is the metadata I've defined. I could define more attributes or use child nodes to define additional metadata.

Now I can access that element (and it's metadata) from any iron-meta instance via the byKey method, e.g.

meta.byKey('info').getAttribute('value');

Pure imperative form would be like:

document.createElement('iron-meta').byKey('info').getAttribute('value');

Or, in a Polymer element, you can include a meta in your template:

<iron-meta id="meta"></iron-meta>
...
this.$.meta.byKey('info').getAttribute('value');

##<iron-meta-query>

iron-meta is a generic element you can use for sharing information across the DOM tree. It uses monostate pattern such that any instance of iron-meta has access to the shared information. You can use iron-meta to share whatever you want (or create an extension [like x-meta] for enhancements).

The iron-meta instances containing your actual data can be loaded in an import, or constructed in any way you see fit. The only requirement is that you create them before you try to access them.

Examples:

If I create an instance like this:

<iron-meta key="info" value="foo/bar"></iron-meta>

Note that value="foo/bar" is the metadata I've defined. I could define more attributes or use child nodes to define additional metadata.

Now I can access that element (and it's metadata) from any iron-meta instance via the byKey method, e.g.

meta.byKey('info').getAttribute('value');

Pure imperative form would be like:

document.createElement('iron-meta').byKey('info').getAttribute('value');

Or, in a Polymer element, you can include a meta in your template:

<iron-meta id="meta"></iron-meta>
...
this.$.meta.byKey('info').getAttribute('value');

About

Element for creating and accessing self-organizing meta-databases

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • HTML 100.0%