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

Unified Diff: pkg/polymer/lib/elements/polymer-google-jsapi/polymer-google-jsapi.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-google-jsapi/polymer-google-jsapi.html
diff --git a/pkg/polymer/lib/elements/polymer-google-jsapi/polymer-google-jsapi.html b/pkg/polymer/lib/elements/polymer-google-jsapi/polymer-google-jsapi.html
new file mode 100644
index 0000000000000000000000000000000000000000..8b41c97b107cdd4f91eb66f1eca105846c83cf24
--- /dev/null
+++ b/pkg/polymer/lib/elements/polymer-google-jsapi/polymer-google-jsapi.html
@@ -0,0 +1,63 @@
+<!--
+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-google-jsapi">
+ <script>
+ (function() {
+ var state = '', instances = [], f;
+ function load() {
+ f = document.createElement('iframe');
+ f.style.display = 'none';
+ document.body.appendChild(f);
+ var d = f.contentWindow ? f.contentWindow.document : (f.contentDocument.document ? f.contentDocument.document : f.contentDocument);
+ d.open();
+ d.write(loader);
+ d.close();
+ }
+ var api;
+ var loaded = function(google) {
+ window.__polymer_google_jsapi = undefined;
+ window.google = api = google;
+ instances.forEach(function(i) {
+ i.provide();
+ });
+ }
+ var loader =
+ '<script type="text/javascript" src="https://www.google.com/jsapi"></scr' + 'ipt>' +
+ '<script>parent.__polymer_google_jsapi(google);</scr' + 'ipt>'
+ ;
+ window.__polymer_google_jsapi = loaded;
+
+ Polymer('polymer-google-jsapi', {
+ ready: function() {
+ switch (state) {
+ case '':
+ instances.push(this);
+ load();
+ state = 'pending';
+ break;
+ case 'pending':
+ instances.push(this);
+ break;
+ case 'ready':
+ this.provide();
+ break;
+ }
+ },
+ provide: function() {
+ this.asyncMethod('notify');
+ },
+ notify: function() {
+ this.fire('polymer-google-jsapi-loaded');
+ },
+ get google() {
+ return api;
+ }
+ });
+ })();
+ </script>
+</polymer-element>
« no previous file with comments | « pkg/polymer/lib/elements/polymer-google-jsapi/index.html ('k') | pkg/polymer/lib/elements/polymer-grid-layout/.bower.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698