Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## In 0.5
- Implementing `<core-meta>`:
- ```html
- <link rel="import" href="../core-meta/core-meta.html">
- <polymer-element name="core-foo" extends="core-meta">
- <script>
- Polymer('core-foo', {
- ready: function () {
- this.super();
- // etc..
- }
- });
- </script>
- </polymer-element>
- ```
- Accessing `<core-meta>`:
- ```html
- <link rel="import" href="../core-foo/core-foo.html">
- <polymer-element name="core-bar">
- <script>
- (function () {
- var meta;
- Polymer('core-bar', {
- ready: function () {
- if (!meta) {
- meta = document.createElement('core-meta');
- }
- },
- accessFoo: function () {
- var fooInstance = meta.byId('fooId');
- // etc..
- }
- });
- })();
- </script>
- </polymer-element>
- ```
- ## In 0.8
- Implementing `<core-meta>`:
- ```html
- <link rel="import" href="../core-meta/core-meta.html">
- <template>
- <core-meta type="fooType" id="fooId" value="[[]]"></core-meta>
- </template>
- <script>
- Polymer({
- is: 'core-foo'
- // etc..
- });
- </script>
- ```
- Accessing `<core-meta>`:
- ```html
- <link rel="import" href="../core-meta/core-meta.html">
- <template>
- <core-meta type="fooType" id="fooId"></core-meta>
- </template>
- <script>
- Polymer({
- is: 'core-bar',
- accessFoo: function () {
- var fooInstance = this.$.fooId.value;
- // etc..
- }
- });
- </script>
- ```
- ### 0.8 Mixin
- Implementing core-meta:
- ```html
- <link rel="import" href="../core-meta/core-meta.html">
- <script>
- using(['CoreMeta'], function(CoreMeta) {
- Polymer({
- is: 'core-foo',
- getInitialMeta: function() {
- return {type: 'fooType', id: 'fooId', value: '[[]]'};
- },
- mixins: [CoreMeta],
- // etc...
- });
- });
- </script>
- ```
- Accessing core-meta:
- ```html
- <link rel="import" href="../core-meta/core-meta.html">
- <script>
- using(['CoreMeta'], function(CoreMeta) {
- Polymer({
- is: 'core-bar',
- mixins: [CoreMeta],
- accessFoo: function () {
- var fooInstance = this.meta.byId('fooId').value;
- // etc..
- }
- });
- });
- </script>
- ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement