Added Polymer
This commit is contained in:
18
rpg-docs/public/bower_components/core-signals/.bower.json
vendored
Normal file
18
rpg-docs/public/bower_components/core-signals/.bower.json
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "core-signals",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"polymer": "Polymer/polymer#^0.5.0"
|
||||
},
|
||||
"version": "0.5.1",
|
||||
"homepage": "https://github.com/Polymer/core-signals",
|
||||
"_release": "0.5.1",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "0.5.1",
|
||||
"commit": "5b84ae78099028efbac3e62e5ca53f72a0630796"
|
||||
},
|
||||
"_source": "git://github.com/Polymer/core-signals.git",
|
||||
"_target": "^0.5.0",
|
||||
"_originalSource": "Polymer/core-signals"
|
||||
}
|
||||
4
rpg-docs/public/bower_components/core-signals/README.md
vendored
Normal file
4
rpg-docs/public/bower_components/core-signals/README.md
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
core-signals
|
||||
============
|
||||
|
||||
See the [component page](http://www.polymer-project.org/docs/elements/core-elements.html#core-signals) for more information.
|
||||
8
rpg-docs/public/bower_components/core-signals/bower.json
vendored
Normal file
8
rpg-docs/public/bower_components/core-signals/bower.json
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"name": "core-signals",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"polymer": "Polymer/polymer#^0.5.0"
|
||||
},
|
||||
"version": "0.5.1"
|
||||
}
|
||||
84
rpg-docs/public/bower_components/core-signals/core-signals.html
vendored
Normal file
84
rpg-docs/public/bower_components/core-signals/core-signals.html
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
<!--
|
||||
Copyright (c) 2014 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
|
||||
The complete set of authors may be found at http://polymer.github.io/AUTHORS
|
||||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS
|
||||
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
|
||||
-->
|
||||
<link rel="import" href="../polymer/polymer.html">
|
||||
|
||||
<!--
|
||||
`core-signals` provides basic publish-subscribe functionality.
|
||||
|
||||
Note: avoid using `core-signals` whenever you can use
|
||||
a controller (parent element) to mediate communication
|
||||
instead.
|
||||
|
||||
To send a signal, fire a custom event of type `core-signal`, with
|
||||
a detail object containing `name` and `data` fields.
|
||||
|
||||
this.fire('core-signal', {name: 'hello', data: null});
|
||||
|
||||
To receive a signal, listen for `core-signal-<name>` event on a
|
||||
`core-signals` element.
|
||||
|
||||
<core-signals on-core-signal-hello="{{helloSignal}}">
|
||||
|
||||
You can fire a signal event from anywhere, and all
|
||||
`core-signals` elements will receive the event, regardless
|
||||
of where they are in DOM.
|
||||
|
||||
@group Polymer Core Elements
|
||||
@element core-signals
|
||||
@status stable
|
||||
@homepage github.io
|
||||
-->
|
||||
<polymer-element name="core-signals">
|
||||
<script>
|
||||
(function(){
|
||||
|
||||
Polymer({
|
||||
attached: function() {
|
||||
signals.push(this);
|
||||
},
|
||||
removed: function() {
|
||||
var i = signals.indexOf(this);
|
||||
if (i >= 0) {
|
||||
signals.splice(i, 1);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// private shared database
|
||||
var signals = [];
|
||||
|
||||
// signal dispatcher
|
||||
function notify(name, data) {
|
||||
// convert generic-signal event to named-signal event
|
||||
var signal = new CustomEvent('core-signal-' + name, {
|
||||
// if signals bubble, it's easy to get confusing duplicates
|
||||
// (1) listen on a container on behalf of local child
|
||||
// (2) some deep child ignores the event and it bubbles
|
||||
// up to said container
|
||||
// (3) local child event bubbles up to container
|
||||
// also, for performance, we avoid signals flying up the
|
||||
// tree from all over the place
|
||||
bubbles: false,
|
||||
detail: data
|
||||
});
|
||||
// dispatch named-signal to all 'signals' instances,
|
||||
// only interested listeners will react
|
||||
signals.forEach(function(s) {
|
||||
s.dispatchEvent(signal);
|
||||
});
|
||||
}
|
||||
|
||||
// signal listener at document
|
||||
document.addEventListener('core-signal', function(e) {
|
||||
notify(e.detail.name, e.detail.data);
|
||||
});
|
||||
|
||||
})();
|
||||
</script>
|
||||
</polymer-element>
|
||||
53
rpg-docs/public/bower_components/core-signals/demo.html
vendored
Normal file
53
rpg-docs/public/bower_components/core-signals/demo.html
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
<!--
|
||||
Copyright (c) 2014 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
|
||||
-->
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
|
||||
<title></title>
|
||||
|
||||
<script src="../webcomponentsjs/webcomponents.js"></script>
|
||||
|
||||
<link rel="import" href="core-signals.html">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<my-element></my-element>
|
||||
<my-app></my-app>
|
||||
|
||||
<polymer-element name="my-element">
|
||||
<template>
|
||||
Hello
|
||||
</template>
|
||||
<script>
|
||||
Polymer('my-element', {
|
||||
ready: function() {
|
||||
this.asyncFire('core-signal', {name: "foo", data: "Foo!"});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</polymer-element>
|
||||
|
||||
<polymer-element name="my-app">
|
||||
<template>
|
||||
<core-signals on-core-signal-foo="{{fooSignal}}"></core-signals>
|
||||
<content></content>
|
||||
</template>
|
||||
<script>
|
||||
Polymer('my-app', {
|
||||
fooSignal: function(e, detail, sender) {
|
||||
this.innerHTML += '<br>[my-app] got a [' + detail + '] signal<br>';
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</polymer-element>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
22
rpg-docs/public/bower_components/core-signals/index.html
vendored
Normal file
22
rpg-docs/public/bower_components/core-signals/index.html
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
<!doctype html>
|
||||
<!--
|
||||
Copyright (c) 2014 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
|
||||
The complete set of authors may be found at http://polymer.github.io/AUTHORS
|
||||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS
|
||||
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
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
|
||||
<script src="../webcomponentsjs/webcomponents.js"></script>
|
||||
<link rel="import" href="../core-component-page/core-component-page.html">
|
||||
|
||||
</head>
|
||||
<body unresolved>
|
||||
|
||||
<core-component-page></core-component-page>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user