Coder Social home page Coder Social logo

iron-meta's Introduction

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');

Pure imperative form would be like:

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

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

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

##<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');

Pure imperative form would be like:

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

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

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

iron-meta's People

Contributors

addyosmani avatar bicknellr avatar blasten avatar cdata avatar dfreedm avatar e111077 avatar ebidel avatar frankiefu avatar fredj avatar garlicnation avatar jklein24 avatar notwaldorf avatar rictic avatar sorvell avatar tedium-bot avatar tjsavage avatar tommycli avatar tyriar avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.