OLD | NEW |
(Empty) | |
| 1 <!-- |
| 2 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. |
| 3 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt |
| 4 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
| 5 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt |
| 6 Code distributed by Google as part of the polymer project is also |
| 7 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt |
| 8 --><!-- |
| 9 `iron-meta` is a generic element you can use for sharing information across the
DOM tree. |
| 10 It uses [monostate pattern](http://c2.com/cgi/wiki?MonostatePattern) such that a
ny |
| 11 instance of iron-meta has access to the shared |
| 12 information. You can use `iron-meta` to share whatever you want (or create an ex
tension |
| 13 [like x-meta] for enhancements). |
| 14 |
| 15 The `iron-meta` instances containing your actual data can be loaded in an import
, |
| 16 or constructed in any way you see fit. The only requirement is that you create t
hem |
| 17 before you try to access them. |
| 18 |
| 19 Examples: |
| 20 |
| 21 If I create an instance like this: |
| 22 |
| 23 <iron-meta key="info" keyUrl="foo/bar"></iron-meta> |
| 24 |
| 25 Note that keyUrl="foo/bar" is the metadata I've defined. I could define more |
| 26 attributes or use child nodes to define additional metadata. |
| 27 |
| 28 Now I can access that element (and it's metadata) from any iron-meta instance |
| 29 via the byKey method, e.g. |
| 30 |
| 31 meta.byKey('info').getAttribute('keyUrl'). |
| 32 |
| 33 Pure imperative form would be like: |
| 34 |
| 35 document.createElement('iron-meta').byKey('info').getAttribute('keyUrl'); |
| 36 |
| 37 Or, in a Polymer element, you can include a meta in your template: |
| 38 |
| 39 <iron-meta id="meta"></iron-meta> |
| 40 ... |
| 41 this.$.meta.byKey('info').getAttribute('keyUrl'); |
| 42 |
| 43 @group Polymer Iron Elements |
| 44 @element iron-meta |
| 45 --><html><head><link rel="import" href="../polymer/polymer.html"> |
| 46 |
| 47 </head><body><script src="iron-meta-extracted.js"></script></body></html> |
OLD | NEW |