| OLD | NEW |
| 1 <!-- | 1 <!-- |
| 2 @license |
| 2 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. | 3 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 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 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 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 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 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt |
| 8 --> | 9 --> |
| 9 | 10 |
| 11 <link rel="import" href="../polymer/polymer.html"> |
| 12 |
| 10 <!-- | 13 <!-- |
| 11 `iron-meta` is a generic element you can use for sharing information across the
DOM tree. | 14 `iron-meta` is a generic element you can use for sharing information across the
DOM tree. |
| 12 It uses [monostate pattern](http://c2.com/cgi/wiki?MonostatePattern) such that a
ny | 15 It uses [monostate pattern](http://c2.com/cgi/wiki?MonostatePattern) such that a
ny |
| 13 instance of iron-meta has access to the shared | 16 instance of iron-meta has access to the shared |
| 14 information. You can use `iron-meta` to share whatever you want (or create an ex
tension | 17 information. You can use `iron-meta` to share whatever you want (or create an ex
tension |
| 15 [like x-meta] for enhancements). | 18 [like x-meta] for enhancements). |
| 16 | 19 |
| 17 The `iron-meta` instances containing your actual data can be loaded in an import
, | 20 The `iron-meta` instances containing your actual data can be loaded in an import
, |
| 18 or constructed in any way you see fit. The only requirement is that you create t
hem | 21 or constructed in any way you see fit. The only requirement is that you create t
hem |
| 19 before you try to access them. | 22 before you try to access them. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 35 Pure imperative form would be like: | 38 Pure imperative form would be like: |
| 36 | 39 |
| 37 document.createElement('iron-meta').byKey('info').getAttribute('keyUrl'); | 40 document.createElement('iron-meta').byKey('info').getAttribute('keyUrl'); |
| 38 | 41 |
| 39 Or, in a Polymer element, you can include a meta in your template: | 42 Or, in a Polymer element, you can include a meta in your template: |
| 40 | 43 |
| 41 <iron-meta id="meta"></iron-meta> | 44 <iron-meta id="meta"></iron-meta> |
| 42 ... | 45 ... |
| 43 this.$.meta.byKey('info').getAttribute('keyUrl'); | 46 this.$.meta.byKey('info').getAttribute('keyUrl'); |
| 44 | 47 |
| 45 @group Polymer Iron Elements | 48 @group Iron Elements |
| 49 @demo demo/index.html |
| 50 @hero hero.svg |
| 46 @element iron-meta | 51 @element iron-meta |
| 47 --> | 52 --> |
| 48 | 53 |
| 49 <link rel="import" href="../polymer/polymer.html"> | |
| 50 | |
| 51 <script> | 54 <script> |
| 52 | 55 |
| 53 (function() { | 56 (function() { |
| 54 | 57 |
| 55 // monostate data | 58 // monostate data |
| 56 var metaDatas = {}; | 59 var metaDatas = {}; |
| 57 var metaArrays = {}; | 60 var metaArrays = {}; |
| 58 | 61 |
| 59 Polymer.IronMeta = Polymer({ | 62 Polymer.IronMeta = Polymer({ |
| 60 | 63 |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 * @returns * | 343 * @returns * |
| 341 */ | 344 */ |
| 342 byKey: function(key) { | 345 byKey: function(key) { |
| 343 return this._metaData && this._metaData[key]; | 346 return this._metaData && this._metaData[key]; |
| 344 } | 347 } |
| 345 | 348 |
| 346 }); | 349 }); |
| 347 | 350 |
| 348 })(); | 351 })(); |
| 349 </script> | 352 </script> |
| OLD | NEW |