Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1000)

Unified Diff: pkg/polymer/lib/elements/polymer-signals/polymer-signals.html

Issue 175443005: [polymer] import all elements (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: updated from bower Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/polymer/lib/elements/polymer-signals/polymer-signals.html
diff --git a/pkg/polymer/lib/elements/polymer-signals/polymer-signals.html b/pkg/polymer/lib/elements/polymer-signals/polymer-signals.html
new file mode 100644
index 0000000000000000000000000000000000000000..3aecf2ffa036069a05656c75b6a7cb3ebfd88830
--- /dev/null
+++ b/pkg/polymer/lib/elements/polymer-signals/polymer-signals.html
@@ -0,0 +1,43 @@
+<!--
+Copyright 2013 The Polymer Authors. All rights reserved.
+Use of this source code is governed by a BSD-style
+license that can be found in the LICENSE file.
+-->
+<link rel="import" href="../polymer/polymer.html">
+
+<polymer-element name="polymer-signals">
+ <script>
+ (function(){
+ Polymer('polymer-signals', {
+ enteredView: 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('polymer-signal-' + name, {
+ bubbles: true,
+ 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('polymer-signal', function(e) {
+ notify(e.detail.name, e.detail.data);
+ });
+ })();
+ </script>
+</polymer-element>
« no previous file with comments | « pkg/polymer/lib/elements/polymer-signals/index.html ('k') | pkg/polymer/lib/elements/polymer-ui-accordion/.bower.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698