Skip to content

Commit

Permalink
2.0-preview initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
e111077 committed Sep 1, 2017
1 parent a0d3b0d commit db6b9ed
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 12 deletions.
3 changes: 2 additions & 1 deletion .gitignore
@@ -1,2 +1,3 @@
bower_components
bower_components*
node_modules
bower-*
26 changes: 20 additions & 6 deletions bower.json
Expand Up @@ -23,13 +23,27 @@
"google"
],
"dependencies": {
"google-apis": "GoogleWebComponents/google-apis#^1.0.0",
"iron-ajax": "PolymerElements/iron-ajax#^1.0.0",
"polymer": "Polymer/polymer#^1.0.0",
"promise-polyfill": "PolymerLabs/promise-polyfill#^1.0.0"
"google-apis": "GoogleWebComponents/google-apis#1 - 2",
"iron-ajax": "PolymerElements/iron-ajax#1 - 2",
"polymer": "Polymer/polymer#1.9 - 2"
},
"devDependencies": {
"iron-component-page": "PolymerElements/iron-component-page#^1.0.2",
"web-component-tester": "*"
"iron-component-page": "PolymerElements/iron-component-page#1 - 2",
"promise-polyfill": "PolymerLabs/promise-polyfill#1 - 2",
"web-component-tester": "^6.0.0"
},
"variants": {
"1.x": {
"dependencies": {
"google-apis": "GoogleWebComponents/google-apis#^1.0.0",
"iron-ajax": "PolymerElements/iron-ajax#^1.0.0",
"polymer": "Polymer/polymer#^1.0.0",
"promise-polyfill": "PolymerLabs/promise-polyfill#^1.0.0"
},
"devDependencies": {
"iron-component-page": "PolymerElements/iron-component-page#^1.0.2",
"web-component-tester": "*"
}
}
}
}
19 changes: 16 additions & 3 deletions google-chart.html
Expand Up @@ -233,7 +233,7 @@
* undefined}
*/
data: {
type: Object,
type: String,
observer: '_dataChanged'
},

Expand Down Expand Up @@ -433,12 +433,25 @@
_dataChanged: function(data) {
var dataPromise;
if (!data) { return; }
if (typeof data == 'string' || data instanceof String) {

var isString = false;

// Polymer 2 will not call observer if type:Object is set and fails, so
// we must parse the string ourselves.
try {
data = JSON.parse(data);
} catch (e) {
isString = typeof data == 'string' || data instanceof String;
}

if (isString) {
// Load data asynchronously, from external URL.
var request = /** @type {!IronRequestElement} */ (document.createElement('iron-request'));
dataPromise = request.send({
url: /** @type string */(data), handleAs: 'json'
}).then(function(xhr) { return xhr.response; });
}).then(function(xhr) {
return xhr.response;
});
} else {
// Data is all ready to be processed.
dataPromise = Promise.resolve(data);
Expand Down
5 changes: 3 additions & 2 deletions test/index.html
Expand Up @@ -14,15 +14,16 @@
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
<title>Tests</title>

<script src="../../webcomponentsjs/webcomponents.min.js"></script>
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<script src="../../web-component-tester/browser.js"></script>
</head>

<body>
<script>
// Load and run all tests (.html, .js) as one suite:
WCT.loadSuites([
'basic-tests.html'
'basic-tests.html?wc-shadydom=true&wc-ce=true',
'basic-tests.html?dom=shadow'
]);
</script>
</body>
Expand Down

0 comments on commit db6b9ed

Please sign in to comment.