Skip to content

Commit abaf38d

Browse files
committed
Add bower_components directory
1 parent 3207095 commit abaf38d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+9412
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "core-action-icons",
3+
"homepage": "https://github.com/Polymer/core-action-icons",
4+
"version": "0.2.4",
5+
"_release": "0.2.4",
6+
"_resolution": {
7+
"type": "version",
8+
"tag": "0.2.4",
9+
"commit": "ad77cdb093594f1b5a8e62fedd0885f531b48859"
10+
},
11+
"_source": "git://github.com/Polymer/core-action-icons.git",
12+
"_target": "0.2.4",
13+
"_originalSource": "Polymer/core-action-icons"
14+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
core-action-icons
2+
=================
3+
4+
This is a _resource_ component which contains image assets for the default core icon set.
5+
6+
While HTML, JS, and CSS can be combined for production deployments by tools like Vulcanizer, some assets are easier to deliver as is.
7+
8+
Projects using the default core icon set should include this component in deployments verbatim.
33.3 KB
Loading
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"name": "core-ajax",
3+
"private": true,
4+
"dependencies": {
5+
"polymer": "Polymer/polymer#0.2.4"
6+
},
7+
"version": "0.2.4",
8+
"homepage": "https://github.com/Polymer/core-ajax",
9+
"_release": "0.2.4",
10+
"_resolution": {
11+
"type": "version",
12+
"tag": "0.2.4",
13+
"commit": "5718fcbbc4e9770de93e676ea57f40afac0d8c82"
14+
},
15+
"_source": "git://github.com/Polymer/core-ajax.git",
16+
"_target": "0.2.4",
17+
"_originalSource": "Polymer/core-ajax"
18+
}

bower_components/core-ajax/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
core-ajax
2+
=========
3+
4+
See the [component page](http://polymer.github.io/core-ajax) for more information.

bower_components/core-ajax/bower.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "core-ajax",
3+
"private": true,
4+
"dependencies": {
5+
"polymer": "Polymer/polymer#0.2.4"
6+
},
7+
"version": "0.2.4"
8+
}
Lines changed: 307 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,307 @@
1+
<!--
2+
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
3+
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
4+
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
5+
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
6+
Code distributed by Google as part of the polymer project is also
7+
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
8+
-->
9+
10+
<!--
11+
@group Polymer Core Elements
12+
13+
The `core-ajax` element exposes `XMLHttpRequest` functionality.
14+
15+
<core-ajax
16+
auto
17+
url="http://gdata.youtube.com/feeds/api/videos/"
18+
params='{"alt":"json", "q":"chrome"}'
19+
handleAs="json"
20+
on-core-response="{{handleResponse}}"></core-ajax>
21+
22+
With `auto` set to `true`, the element performs a request whenever
23+
its `url` or `params` properties are changed.
24+
25+
Note: The `params` attribute must be double quoted JSON.
26+
27+
You can trigger a request explicitly by calling `go` on the
28+
element.
29+
30+
@element core-ajax
31+
@status beta
32+
@homepage github.io
33+
-->
34+
<link rel="import" href="core-xhr.html">
35+
<polymer-element name="core-ajax" attributes="url handleAs auto params response method headers body contentType withCredentials">
36+
<script>
37+
38+
Polymer('core-ajax', {
39+
/**
40+
* Fired when a response is received.
41+
*
42+
* @event core-response
43+
*/
44+
45+
/**
46+
* Fired when an error is received.
47+
*
48+
* @event core-error
49+
*/
50+
51+
/**
52+
* Fired whenever a response or an error is received.
53+
*
54+
* @event core-complete
55+
*/
56+
57+
/**
58+
* The URL target of the request.
59+
*
60+
* @attribute url
61+
* @type string
62+
* @default ''
63+
*/
64+
url: '',
65+
66+
/**
67+
* Specifies what data to store in the `response` property, and
68+
* to deliver as `event.response` in `response` events.
69+
*
70+
* One of:
71+
*
72+
* `text`: uses `XHR.responseText`.
73+
*
74+
* `xml`: uses `XHR.responseXML`.
75+
*
76+
* `json`: uses `XHR.responseText` parsed as JSON.
77+
*
78+
* `arraybuffer`: uses `XHR.response`.
79+
*
80+
* `blob`: uses `XHR.response`.
81+
*
82+
* `document`: uses `XHR.response`.
83+
*
84+
* @attribute handleAs
85+
* @type string
86+
* @default 'text'
87+
*/
88+
handleAs: '',
89+
90+
/**
91+
* If true, automatically performs an Ajax request when either `url` or `params` changes.
92+
*
93+
* @attribute auto
94+
* @type boolean
95+
* @default false
96+
*/
97+
auto: false,
98+
99+
/**
100+
* Parameters to send to the specified URL, as JSON.
101+
*
102+
* @attribute params
103+
* @type string (JSON)
104+
* @default ''
105+
*/
106+
params: '',
107+
108+
/**
109+
* Returns the response object.
110+
*
111+
* @attribute response
112+
* @type Object
113+
* @default null
114+
*/
115+
response: null,
116+
117+
/**
118+
* The HTTP method to use such as 'GET', 'POST', 'PUT', or 'DELETE'.
119+
* Default is 'GET'.
120+
*
121+
* @attribute method
122+
* @type string
123+
* @default ''
124+
*/
125+
method: '',
126+
127+
/**
128+
* HTTP request headers to send.
129+
*
130+
* Example:
131+
*
132+
* <core-ajax
133+
* auto
134+
* url="http://somesite.com"
135+
* headers='{"X-Requested-With": "XMLHttpRequest"}'
136+
* handleAs="json"
137+
* on-core-response="{{handleResponse}}"></core-ajax>
138+
*
139+
* @attribute headers
140+
* @type Object
141+
* @default null
142+
*/
143+
headers: null,
144+
145+
/**
146+
* Optional raw body content to send when method === "POST".
147+
*
148+
* Example:
149+
*
150+
* <core-ajax method="POST" auto url="http://somesite.com"
151+
* body='{"foo":1, "bar":2}'>
152+
* </core-ajax>
153+
*
154+
* @attribute body
155+
* @type Object
156+
* @default null
157+
*/
158+
body: null,
159+
160+
/**
161+
* Content type to use when sending data.
162+
*
163+
* @attribute contentType
164+
* @type string
165+
* @default 'application/x-www-form-urlencoded'
166+
*/
167+
contentType: 'application/x-www-form-urlencoded',
168+
169+
/**
170+
* Set the withCredentials flag on the request.
171+
*
172+
* @attribute withCredentials
173+
* @type boolean
174+
* @default false
175+
*/
176+
withCredentials: false,
177+
178+
ready: function() {
179+
this.xhr = document.createElement('core-xhr');
180+
},
181+
182+
receive: function(response, xhr) {
183+
if (this.isSuccess(xhr)) {
184+
this.processResponse(xhr);
185+
} else {
186+
this.error(xhr);
187+
}
188+
this.complete(xhr);
189+
},
190+
191+
isSuccess: function(xhr) {
192+
var status = xhr.status || 0;
193+
return !status || (status >= 200 && status < 300);
194+
},
195+
196+
processResponse: function(xhr) {
197+
var response = this.evalResponse(xhr);
198+
this.response = response;
199+
this.fire('core-response', {response: response, xhr: xhr});
200+
},
201+
202+
error: function(xhr) {
203+
var response = xhr.status + ': ' + xhr.responseText;
204+
this.fire('core-error', {response: response, xhr: xhr});
205+
},
206+
207+
complete: function(xhr) {
208+
this.fire('core-complete', {response: xhr.status, xhr: xhr});
209+
},
210+
211+
evalResponse: function(xhr) {
212+
return this[(this.handleAs || 'text') + 'Handler'](xhr);
213+
},
214+
215+
xmlHandler: function(xhr) {
216+
return xhr.responseXML;
217+
},
218+
219+
textHandler: function(xhr) {
220+
return xhr.responseText;
221+
},
222+
223+
jsonHandler: function(xhr) {
224+
var r = xhr.responseText;
225+
try {
226+
return JSON.parse(r);
227+
} catch (x) {
228+
return r;
229+
}
230+
},
231+
232+
documentHandler: function(xhr) {
233+
return xhr.response;
234+
},
235+
236+
blobHandler: function(xhr) {
237+
return xhr.response;
238+
},
239+
240+
arraybufferHandler: function(xhr) {
241+
return xhr.response;
242+
},
243+
244+
urlChanged: function() {
245+
if (!this.handleAs) {
246+
var ext = String(this.url).split('.').pop();
247+
switch (ext) {
248+
case 'json':
249+
this.handleAs = 'json';
250+
break;
251+
}
252+
}
253+
this.autoGo();
254+
},
255+
256+
paramsChanged: function() {
257+
this.autoGo();
258+
},
259+
260+
autoChanged: function() {
261+
this.autoGo();
262+
},
263+
264+
// TODO(sorvell): multiple side-effects could call autoGo
265+
// during one micro-task, use a job to have only one action
266+
// occur
267+
autoGo: function() {
268+
if (this.auto) {
269+
this.goJob = this.job(this.goJob, this.go, 0);
270+
}
271+
},
272+
273+
/**
274+
* Performs an Ajax request to the specified URL.
275+
*
276+
* @method go
277+
*/
278+
go: function() {
279+
var args = this.xhrArgs || {};
280+
// TODO(sjmiles): we may want XHR to default to POST if body is set
281+
args.body = this.body || args.body;
282+
args.params = this.params || args.params;
283+
if (args.params && typeof(args.params) == 'string') {
284+
args.params = JSON.parse(args.params);
285+
}
286+
args.headers = this.headers || args.headers || {};
287+
if (args.headers && typeof(args.headers) == 'string') {
288+
args.headers = JSON.parse(args.headers);
289+
}
290+
if (this.contentType) {
291+
args.headers['content-type'] = this.contentType;
292+
}
293+
if (this.handleAs === 'arraybuffer' || this.handleAs === 'blob' ||
294+
this.handleAs === 'document') {
295+
args.responseType = this.handleAs;
296+
}
297+
args.withCredentials = this.withCredentials;
298+
args.callback = this.receive.bind(this);
299+
args.url = this.url;
300+
args.method = this.method;
301+
return args.url && this.xhr.request(args);
302+
}
303+
304+
});
305+
306+
</script>
307+
</polymer-element>

0 commit comments

Comments
 (0)