@polymer/iron-meta
Advanced tools
Comparing version 3.0.0-pre.12 to 3.0.0-pre.13
@@ -1,4 +0,67 @@ | ||
import '@polymer/polymer/polymer-legacy.js'; | ||
import { Polymer as Polymer$0 } from '@polymer/polymer/lib/legacy/polymer-fn.js'; | ||
/** | ||
@license | ||
Copyright (c) 2015 The Polymer Project Authors. All rights reserved. | ||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt | ||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt | ||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt | ||
Code distributed by Google as part of the polymer project is also | ||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt | ||
*/ | ||
/** | ||
`iron-meta` is a generic element you can use for sharing information across the DOM tree. | ||
It uses [monostate pattern](http://c2.com/cgi/wiki?MonostatePattern) 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'); | ||
@group Iron Elements | ||
@demo demo/index.html | ||
@hero hero.svg | ||
@element iron-meta | ||
*/ | ||
/* | ||
FIXME(polymer-modulizer): the above comments were extracted | ||
from HTML and may be out of place here. Review them and | ||
then delete this comment! | ||
*/ | ||
import '../polymer/polymer-legacy.js'; | ||
import { Polymer as Polymer$0 } from '../polymer/lib/legacy/polymer-fn.js'; | ||
/** | ||
* @constructor | ||
* @param {{ | ||
* type: (string|null|undefined), | ||
* key: (string|null|undefined), | ||
* value: *, | ||
* }=} options | ||
*/ | ||
export const IronMeta = function(options) { | ||
@@ -18,3 +81,3 @@ IronMeta[' '](options); | ||
// a value. | ||
IronMeta[' '] = function(){}; | ||
IronMeta[' '] = function() {}; | ||
@@ -106,22 +169,11 @@ IronMeta.types = {}; | ||
*/ | ||
self: { | ||
type: Boolean, | ||
observer: '_selfChanged' | ||
}, | ||
self: {type: Boolean, observer: '_selfChanged'}, | ||
__meta: { | ||
type: Boolean, | ||
computed: '__computeMeta(type, key, value)' | ||
} | ||
__meta: {type: Boolean, computed: '__computeMeta(type, key, value)'} | ||
}, | ||
hostAttributes: { | ||
hidden: true | ||
}, | ||
hostAttributes: {hidden: true}, | ||
__computeMeta: function(type, key, value) { | ||
var meta = new IronMeta({ | ||
type: type, | ||
key: key | ||
}); | ||
var meta = new IronMeta({type: type, key: key}); | ||
@@ -155,7 +207,4 @@ if (value !== undefined && value !== meta.value) { | ||
byKey: function(key) { | ||
return new IronMeta({ | ||
type: this.type, | ||
key: key | ||
}).value; | ||
return new IronMeta({type: this.type, key: key}).value; | ||
} | ||
}); |
@@ -16,11 +16,13 @@ { | ||
"bower": "^1.8.0", | ||
"@polymer/paper-styles": "3.0.0-pre.12", | ||
"@polymer/test-fixture": "3.0.0-pre.12", | ||
"wct-browser-legacy": "0.0.1-pre.11", | ||
"@webcomponents/webcomponentsjs": "^1.0.0" | ||
"webmat": "^0.2.0", | ||
"@polymer/paper-styles": "^3.0.0-pre.13", | ||
"@polymer/test-fixture": "^3.0.0-pre.13", | ||
"wct-browser-legacy": "^0.0.1-pre.11", | ||
"@webcomponents/webcomponentsjs": "^2.0.0-0" | ||
}, | ||
"scripts": { | ||
"update-types": "bower install && gen-typescript-declarations --deleteExisting --outDir ." | ||
"update-types": "bower install && gen-typescript-declarations --deleteExisting --outDir .", | ||
"format": "webmat && npm run update-types" | ||
}, | ||
"version": "3.0.0-pre.12", | ||
"version": "3.0.0-pre.13", | ||
"resolutions": { | ||
@@ -35,4 +37,4 @@ "inherits": "2.0.3", | ||
"dependencies": { | ||
"@polymer/polymer": "3.0.0-pre.12" | ||
"@polymer/polymer": "^3.0.0-pre.13" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26237
203
7
+ Added@polymer/polymer@3.5.2(transitive)
- Removed@polymer/polymer@3.0.0-pre.12(transitive)
- Removed@webcomponents/webcomponentsjs@1.3.3(transitive)