@@ -45,6 +45,16 | |||
|
45 | 45 | "style-loader": "^0.21.0", |
|
46 | 46 | "webpack-uglify-js-plugin": "^1.1.9", |
|
47 | 47 | "raw-loader": "1.0.0-beta.0", |
|
48 | "ts-loader": "^1.3.3" | |
|
48 | "ts-loader": "^1.3.3", | |
|
49 | "@webcomponents/webcomponentsjs": "^2.0.0", | |
|
50 | "@polymer/polymer": "^3.0.0", | |
|
51 | "@polymer/paper-button": "^3.0.0", | |
|
52 | "@polymer/paper-spinner": "^3.0.0", | |
|
53 | "@polymer/paper-tooltip": "^3.0.0", | |
|
54 | "@polymer/paper-toast": "^3.0.0", | |
|
55 | "@polymer/paper-toggle-button": "^3.0.0", | |
|
56 | "@polymer/iron-ajax": "^3.0.0", | |
|
57 | "@polymer/iron-autogrow-textarea": "^3.0.0", | |
|
58 | "@polymer/iron-a11y-keys": "^3.0.0" | |
|
49 | 59 | } |
|
50 | 60 | } |
@@ -4,6 +4,222 | |||
|
4 | 4 | |
|
5 | 5 | let |
|
6 | 6 | sources = { |
|
7 | "@polymer/font-roboto-3.0.2" = { | |
|
8 | name = "_at_polymer_slash_font-roboto"; | |
|
9 | packageName = "@polymer/font-roboto"; | |
|
10 | version = "3.0.2"; | |
|
11 | src = fetchurl { | |
|
12 | url = "https://registry.npmjs.org/@polymer/font-roboto/-/font-roboto-3.0.2.tgz"; | |
|
13 | sha512 = "tx5TauYSmzsIvmSqepUPDYbs4/Ejz2XbZ1IkD7JEGqkdNUJlh+9KU85G56Tfdk/xjEZ8zorFfN09OSwiMrIQWA=="; | |
|
14 | }; | |
|
15 | }; | |
|
16 | "@polymer/iron-a11y-announcer-3.0.1" = { | |
|
17 | name = "_at_polymer_slash_iron-a11y-announcer"; | |
|
18 | packageName = "@polymer/iron-a11y-announcer"; | |
|
19 | version = "3.0.1"; | |
|
20 | src = fetchurl { | |
|
21 | url = "https://registry.npmjs.org/@polymer/iron-a11y-announcer/-/iron-a11y-announcer-3.0.1.tgz"; | |
|
22 | sha512 = "Xiqmpz0AEEbMNGYPpbrXBIrcI/xaR4tn77pmSLfxVKGGwjEUR/YrRgyIwXp4EN7lvst1dFC8kyl2hLga0uDIVQ=="; | |
|
23 | }; | |
|
24 | }; | |
|
25 | "@polymer/iron-a11y-keys-3.0.1" = { | |
|
26 | name = "_at_polymer_slash_iron-a11y-keys"; | |
|
27 | packageName = "@polymer/iron-a11y-keys"; | |
|
28 | version = "3.0.1"; | |
|
29 | src = fetchurl { | |
|
30 | url = "https://registry.npmjs.org/@polymer/iron-a11y-keys/-/iron-a11y-keys-3.0.1.tgz"; | |
|
31 | sha512 = "zmTi8xHeY4ZMJLAitW2hAmW5zXZ35hVy/eHQUFadAlOccuBK3oRRmoPRQRaZgpyJrCVFDAQRXXzzJtUDil/0CA=="; | |
|
32 | }; | |
|
33 | }; | |
|
34 | "@polymer/iron-a11y-keys-behavior-3.0.1" = { | |
|
35 | name = "_at_polymer_slash_iron-a11y-keys-behavior"; | |
|
36 | packageName = "@polymer/iron-a11y-keys-behavior"; | |
|
37 | version = "3.0.1"; | |
|
38 | src = fetchurl { | |
|
39 | url = "https://registry.npmjs.org/@polymer/iron-a11y-keys-behavior/-/iron-a11y-keys-behavior-3.0.1.tgz"; | |
|
40 | sha512 = "lnrjKq3ysbBPT/74l0Fj0U9H9C35Tpw2C/tpJ8a+5g8Y3YJs1WSZYnEl1yOkw6sEyaxOq/1DkzH0+60gGu5/PQ=="; | |
|
41 | }; | |
|
42 | }; | |
|
43 | "@polymer/iron-ajax-3.0.1" = { | |
|
44 | name = "_at_polymer_slash_iron-ajax"; | |
|
45 | packageName = "@polymer/iron-ajax"; | |
|
46 | version = "3.0.1"; | |
|
47 | src = fetchurl { | |
|
48 | url = "https://registry.npmjs.org/@polymer/iron-ajax/-/iron-ajax-3.0.1.tgz"; | |
|
49 | sha512 = "7+TPEAfWsRdhj1Y8UeF1759ktpVu+c3sG16rJiUC3wF9+woQ9xI1zUm2d59i7Yc3aDEJrR/Q8Y262KlOvyGVNg=="; | |
|
50 | }; | |
|
51 | }; | |
|
52 | "@polymer/iron-autogrow-textarea-3.0.1" = { | |
|
53 | name = "_at_polymer_slash_iron-autogrow-textarea"; | |
|
54 | packageName = "@polymer/iron-autogrow-textarea"; | |
|
55 | version = "3.0.1"; | |
|
56 | src = fetchurl { | |
|
57 | url = "https://registry.npmjs.org/@polymer/iron-autogrow-textarea/-/iron-autogrow-textarea-3.0.1.tgz"; | |
|
58 | sha512 = "FgSL7APrOSL9Vu812sBCFlQ17hvnJsBAV2C2e1UAiaHhB+dyfLq8gGdGUpqVWuGJ50q4Y/49QwCNnLf85AdVYA=="; | |
|
59 | }; | |
|
60 | }; | |
|
61 | "@polymer/iron-behaviors-3.0.1" = { | |
|
62 | name = "_at_polymer_slash_iron-behaviors"; | |
|
63 | packageName = "@polymer/iron-behaviors"; | |
|
64 | version = "3.0.1"; | |
|
65 | src = fetchurl { | |
|
66 | url = "https://registry.npmjs.org/@polymer/iron-behaviors/-/iron-behaviors-3.0.1.tgz"; | |
|
67 | sha512 = "IMEwcv1lhf1HSQxuyWOUIL0lOBwmeaoSTpgCJeP9IBYnuB1SPQngmfRuHKgK6/m9LQ9F9miC7p3HeQQUdKAE0w=="; | |
|
68 | }; | |
|
69 | }; | |
|
70 | "@polymer/iron-checked-element-behavior-3.0.1" = { | |
|
71 | name = "_at_polymer_slash_iron-checked-element-behavior"; | |
|
72 | packageName = "@polymer/iron-checked-element-behavior"; | |
|
73 | version = "3.0.1"; | |
|
74 | src = fetchurl { | |
|
75 | url = "https://registry.npmjs.org/@polymer/iron-checked-element-behavior/-/iron-checked-element-behavior-3.0.1.tgz"; | |
|
76 | sha512 = "aDr0cbCNVq49q+pOqa6CZutFh+wWpwPMLpEth9swx+GkAj+gCURhuQkaUYhIo5f2egDbEioR1aeHMnPlU9dQZA=="; | |
|
77 | }; | |
|
78 | }; | |
|
79 | "@polymer/iron-fit-behavior-3.0.1" = { | |
|
80 | name = "_at_polymer_slash_iron-fit-behavior"; | |
|
81 | packageName = "@polymer/iron-fit-behavior"; | |
|
82 | version = "3.0.1"; | |
|
83 | src = fetchurl { | |
|
84 | url = "https://registry.npmjs.org/@polymer/iron-fit-behavior/-/iron-fit-behavior-3.0.1.tgz"; | |
|
85 | sha512 = "/M0B1L30k31vmwNBaGuZcxzUAhJSHoGccb/DF0CDKI/hT8UlkTvcyemaWdOpmHHLgY52ceKIkRwA3AeXrKyvaQ=="; | |
|
86 | }; | |
|
87 | }; | |
|
88 | "@polymer/iron-flex-layout-3.0.1" = { | |
|
89 | name = "_at_polymer_slash_iron-flex-layout"; | |
|
90 | packageName = "@polymer/iron-flex-layout"; | |
|
91 | version = "3.0.1"; | |
|
92 | src = fetchurl { | |
|
93 | url = "https://registry.npmjs.org/@polymer/iron-flex-layout/-/iron-flex-layout-3.0.1.tgz"; | |
|
94 | sha512 = "7gB869czArF+HZcPTVSgvA7tXYFze9EKckvM95NB7SqYF+NnsQyhoXgKnpFwGyo95lUjUW9TFDLUwDXnCYFtkw=="; | |
|
95 | }; | |
|
96 | }; | |
|
97 | "@polymer/iron-form-element-behavior-3.0.1" = { | |
|
98 | name = "_at_polymer_slash_iron-form-element-behavior"; | |
|
99 | packageName = "@polymer/iron-form-element-behavior"; | |
|
100 | version = "3.0.1"; | |
|
101 | src = fetchurl { | |
|
102 | url = "https://registry.npmjs.org/@polymer/iron-form-element-behavior/-/iron-form-element-behavior-3.0.1.tgz"; | |
|
103 | sha512 = "G/e2KXyL5AY7mMjmomHkGpgS0uAf4ovNpKhkuUTRnMuMJuf589bKqE85KN4ovE1Tzhv2hJoh/igyD6ekHiYU1A=="; | |
|
104 | }; | |
|
105 | }; | |
|
106 | "@polymer/iron-meta-3.0.1" = { | |
|
107 | name = "_at_polymer_slash_iron-meta"; | |
|
108 | packageName = "@polymer/iron-meta"; | |
|
109 | version = "3.0.1"; | |
|
110 | src = fetchurl { | |
|
111 | url = "https://registry.npmjs.org/@polymer/iron-meta/-/iron-meta-3.0.1.tgz"; | |
|
112 | sha512 = "pWguPugiLYmWFV9UWxLWzZ6gm4wBwQdDy4VULKwdHCqR7OP7u98h+XDdGZsSlDPv6qoryV/e3tGHlTIT0mbzJA=="; | |
|
113 | }; | |
|
114 | }; | |
|
115 | "@polymer/iron-overlay-behavior-3.0.2" = { | |
|
116 | name = "_at_polymer_slash_iron-overlay-behavior"; | |
|
117 | packageName = "@polymer/iron-overlay-behavior"; | |
|
118 | version = "3.0.2"; | |
|
119 | src = fetchurl { | |
|
120 | url = "https://registry.npmjs.org/@polymer/iron-overlay-behavior/-/iron-overlay-behavior-3.0.2.tgz"; | |
|
121 | sha512 = "j1qmt6mJHCwpe1mKOvqK5kcCUPQr5LSrlqpgRDbUuLgUfNJ/vGTipjrkBlfbEUagm5FEQdc1VLPLSQP6WVuP9g=="; | |
|
122 | }; | |
|
123 | }; | |
|
124 | "@polymer/iron-resizable-behavior-3.0.1" = { | |
|
125 | name = "_at_polymer_slash_iron-resizable-behavior"; | |
|
126 | packageName = "@polymer/iron-resizable-behavior"; | |
|
127 | version = "3.0.1"; | |
|
128 | src = fetchurl { | |
|
129 | url = "https://registry.npmjs.org/@polymer/iron-resizable-behavior/-/iron-resizable-behavior-3.0.1.tgz"; | |
|
130 | sha512 = "FyHxRxFspVoRaeZSWpT3y0C9awomb4tXXolIJcZ7RvXhMP632V5lez+ch5G5SwK0LpnAPkg35eB0LPMFv+YMMQ=="; | |
|
131 | }; | |
|
132 | }; | |
|
133 | "@polymer/iron-validatable-behavior-3.0.1" = { | |
|
134 | name = "_at_polymer_slash_iron-validatable-behavior"; | |
|
135 | packageName = "@polymer/iron-validatable-behavior"; | |
|
136 | version = "3.0.1"; | |
|
137 | src = fetchurl { | |
|
138 | url = "https://registry.npmjs.org/@polymer/iron-validatable-behavior/-/iron-validatable-behavior-3.0.1.tgz"; | |
|
139 | sha512 = "wwpYh6wOa4fNI+jH5EYKC7TVPYQ2OfgQqocWat7GsNWcsblKYhLYbwsvEY5nO0n2xKqNfZzDLrUom5INJN7msQ=="; | |
|
140 | }; | |
|
141 | }; | |
|
142 | "@polymer/paper-behaviors-3.0.1" = { | |
|
143 | name = "_at_polymer_slash_paper-behaviors"; | |
|
144 | packageName = "@polymer/paper-behaviors"; | |
|
145 | version = "3.0.1"; | |
|
146 | src = fetchurl { | |
|
147 | url = "https://registry.npmjs.org/@polymer/paper-behaviors/-/paper-behaviors-3.0.1.tgz"; | |
|
148 | sha512 = "6knhj69fPJejv8qR0kCSUY+Q0XjaUf0OSnkjRjmTJPAwSrRYtgqE+l6P1FfA+py1X/cUjgne9EF5rMZAKJIg1g=="; | |
|
149 | }; | |
|
150 | }; | |
|
151 | "@polymer/paper-button-3.0.1" = { | |
|
152 | name = "_at_polymer_slash_paper-button"; | |
|
153 | packageName = "@polymer/paper-button"; | |
|
154 | version = "3.0.1"; | |
|
155 | src = fetchurl { | |
|
156 | url = "https://registry.npmjs.org/@polymer/paper-button/-/paper-button-3.0.1.tgz"; | |
|
157 | sha512 = "JRNBc+Oj9EWnmyLr7FcCr8T1KAnEHPh6mosln9BUdkM+qYaYsudSICh3cjTIbnj6AuF5OJidoLkM1dlyj0j6Zg=="; | |
|
158 | }; | |
|
159 | }; | |
|
160 | "@polymer/paper-ripple-3.0.1" = { | |
|
161 | name = "_at_polymer_slash_paper-ripple"; | |
|
162 | packageName = "@polymer/paper-ripple"; | |
|
163 | version = "3.0.1"; | |
|
164 | src = fetchurl { | |
|
165 | url = "https://registry.npmjs.org/@polymer/paper-ripple/-/paper-ripple-3.0.1.tgz"; | |
|
166 | sha512 = "dgOe12GyCF1VZBLUQqnzGWlf3xb255FajNCVB1VFj/AtskYtoamnafa7m3a+1vs+C8qbg4Benn5KwgxVDSW4cg=="; | |
|
167 | }; | |
|
168 | }; | |
|
169 | "@polymer/paper-spinner-3.0.1" = { | |
|
170 | name = "_at_polymer_slash_paper-spinner"; | |
|
171 | packageName = "@polymer/paper-spinner"; | |
|
172 | version = "3.0.1"; | |
|
173 | src = fetchurl { | |
|
174 | url = "https://registry.npmjs.org/@polymer/paper-spinner/-/paper-spinner-3.0.1.tgz"; | |
|
175 | sha512 = "MYIU6qWZnhZ5yNFOBzROPgBteGfxKEnDZ6bCgjrvUtJkBuQEz0MQZzSE/zmZc0oaJ9u5QK5xAFuYdudsGv7+sQ=="; | |
|
176 | }; | |
|
177 | }; | |
|
178 | "@polymer/paper-styles-3.0.1" = { | |
|
179 | name = "_at_polymer_slash_paper-styles"; | |
|
180 | packageName = "@polymer/paper-styles"; | |
|
181 | version = "3.0.1"; | |
|
182 | src = fetchurl { | |
|
183 | url = "https://registry.npmjs.org/@polymer/paper-styles/-/paper-styles-3.0.1.tgz"; | |
|
184 | sha512 = "y6hmObLqlCx602TQiSBKHqjwkE7xmDiFkoxdYGaNjtv4xcysOTdVJsDR/R9UHwIaxJ7gHlthMSykir1nv78++g=="; | |
|
185 | }; | |
|
186 | }; | |
|
187 | "@polymer/paper-toast-3.0.1" = { | |
|
188 | name = "_at_polymer_slash_paper-toast"; | |
|
189 | packageName = "@polymer/paper-toast"; | |
|
190 | version = "3.0.1"; | |
|
191 | src = fetchurl { | |
|
192 | url = "https://registry.npmjs.org/@polymer/paper-toast/-/paper-toast-3.0.1.tgz"; | |
|
193 | sha512 = "pizuogzObniDdICUc6dSLrnDt2VzzoRne1gCmbD6sfOATVv5tc8UfrqhA2iHngbNBEbniBiciS3iogdp5KTVUQ=="; | |
|
194 | }; | |
|
195 | }; | |
|
196 | "@polymer/paper-toggle-button-3.0.1" = { | |
|
197 | name = "_at_polymer_slash_paper-toggle-button"; | |
|
198 | packageName = "@polymer/paper-toggle-button"; | |
|
199 | version = "3.0.1"; | |
|
200 | src = fetchurl { | |
|
201 | url = "https://registry.npmjs.org/@polymer/paper-toggle-button/-/paper-toggle-button-3.0.1.tgz"; | |
|
202 | sha512 = "jadZB60fycT7YnSAH0H23LYo6/2HYmMZTtNr9LpdSIRFPLX6mqqxewex92cFz019bMKaRJgORn308hRlJo2u6A=="; | |
|
203 | }; | |
|
204 | }; | |
|
205 | "@polymer/paper-tooltip-3.0.1" = { | |
|
206 | name = "_at_polymer_slash_paper-tooltip"; | |
|
207 | packageName = "@polymer/paper-tooltip"; | |
|
208 | version = "3.0.1"; | |
|
209 | src = fetchurl { | |
|
210 | url = "https://registry.npmjs.org/@polymer/paper-tooltip/-/paper-tooltip-3.0.1.tgz"; | |
|
211 | sha512 = "yiUk09opTEnE1lK+tb501ENb+yQBi4p++Ep0eGJAHesVYKVMPNgPphVKkIizkDaU+n0SE+zXfTsRbYyOMDYXSg=="; | |
|
212 | }; | |
|
213 | }; | |
|
214 | "@polymer/polymer-3.1.0" = { | |
|
215 | name = "_at_polymer_slash_polymer"; | |
|
216 | packageName = "@polymer/polymer"; | |
|
217 | version = "3.1.0"; | |
|
218 | src = fetchurl { | |
|
219 | url = "https://registry.npmjs.org/@polymer/polymer/-/polymer-3.1.0.tgz"; | |
|
220 | sha512 = "hwN8IMERsFATz/9dSMxYHL+84J9uBkPuuarxJWlTsppZ4CAYTZKnepBfNrKoyNsafBmA3yXBiiKPPf+fJtza7A=="; | |
|
221 | }; | |
|
222 | }; | |
|
7 | 223 | "@types/clone-0.1.30" = { |
|
8 | 224 | name = "_at_types_slash_clone"; |
|
9 | 225 | packageName = "@types/clone"; |
@@ -193,6 +409,24 let | |||
|
193 | 409 | sha512 = "mJ3QKWtCchL1vhU/kZlJnLPuQZnlDOdZsyP0bbLWPGdYsQDnSBvyTLhzwBA3QAMlzEL9V4JHygEmK6/OTEyytA=="; |
|
194 | 410 | }; |
|
195 | 411 | }; |
|
412 | "@webcomponents/shadycss-1.5.2" = { | |
|
413 | name = "_at_webcomponents_slash_shadycss"; | |
|
414 | packageName = "@webcomponents/shadycss"; | |
|
415 | version = "1.5.2"; | |
|
416 | src = fetchurl { | |
|
417 | url = "https://registry.npmjs.org/@webcomponents/shadycss/-/shadycss-1.5.2.tgz"; | |
|
418 | sha512 = "0OyrmVc7S+INtzoqP2ofAo+OdVn2Nj0Qvq4wD9FEGN7nMmLRxaD2mzy6hD6EslzxUSuGH302CDU4KXiY66SEqg=="; | |
|
419 | }; | |
|
420 | }; | |
|
421 | "@webcomponents/webcomponentsjs-2.1.3" = { | |
|
422 | name = "_at_webcomponents_slash_webcomponentsjs"; | |
|
423 | packageName = "@webcomponents/webcomponentsjs"; | |
|
424 | version = "2.1.3"; | |
|
425 | src = fetchurl { | |
|
426 | url = "https://registry.npmjs.org/@webcomponents/webcomponentsjs/-/webcomponentsjs-2.1.3.tgz"; | |
|
427 | sha512 = "0UHJNY88lR3pnEYtBVT7F8cuuxOiITQGWJa0LxoELqkBSB7IabzJFOj5K99PajD3CGAsWpjB0CAeijfe376Y1w=="; | |
|
428 | }; | |
|
429 | }; | |
|
196 | 430 | "@xtuc/ieee754-1.2.0" = { |
|
197 | 431 | name = "_at_xtuc_slash_ieee754"; |
|
198 | 432 | packageName = "@xtuc/ieee754"; |
@@ -1454,13 +1688,13 let | |||
|
1454 | 1688 | sha1 = "b534e7c734c4f81ec5fbe8aca2ad24354b962c6c"; |
|
1455 | 1689 | }; |
|
1456 | 1690 | }; |
|
1457 |
"caniuse-db-1.0.30000 |
|
|
1691 | "caniuse-db-1.0.30000900" = { | |
|
1458 | 1692 | name = "caniuse-db"; |
|
1459 | 1693 | packageName = "caniuse-db"; |
|
1460 |
version = "1.0.30000 |
|
|
1461 | src = fetchurl { | |
|
1462 |
url = "https://registry.npmjs.org/caniuse-db/-/caniuse-db-1.0.30000 |
|
|
1463 | sha512 = "MSCUohyoLU4/PGapapw/PLQkmQ+sFgzX6e3tM6ue8HX9HW9rBD5gRiAYKhC8r0QkvUE0pWTA8Ze6f3jrzBizVg=="; | |
|
1694 | version = "1.0.30000900"; | |
|
1695 | src = fetchurl { | |
|
1696 | url = "https://registry.npmjs.org/caniuse-db/-/caniuse-db-1.0.30000900.tgz"; | |
|
1697 | sha512 = "fvicVRDlhHIQpt/bmbLl3hDHKUZb5ZP8O2OuZLz2fSEPlUBbvwwbhhqhGS617ldN6bDoo9A3+MQKQyFq0p7UXA=="; | |
|
1464 | 1698 | }; |
|
1465 | 1699 | }; |
|
1466 | 1700 | "caniuse-lite-1.0.30000899" = { |
@@ -7482,6 +7716,30 let | |||
|
7482 | 7716 | version = "1.0.0"; |
|
7483 | 7717 | src = ./..; |
|
7484 | 7718 | dependencies = [ |
|
7719 | sources."@polymer/font-roboto-3.0.2" | |
|
7720 | sources."@polymer/iron-a11y-announcer-3.0.1" | |
|
7721 | sources."@polymer/iron-a11y-keys-3.0.1" | |
|
7722 | sources."@polymer/iron-a11y-keys-behavior-3.0.1" | |
|
7723 | sources."@polymer/iron-ajax-3.0.1" | |
|
7724 | sources."@polymer/iron-autogrow-textarea-3.0.1" | |
|
7725 | sources."@polymer/iron-behaviors-3.0.1" | |
|
7726 | sources."@polymer/iron-checked-element-behavior-3.0.1" | |
|
7727 | sources."@polymer/iron-fit-behavior-3.0.1" | |
|
7728 | sources."@polymer/iron-flex-layout-3.0.1" | |
|
7729 | sources."@polymer/iron-form-element-behavior-3.0.1" | |
|
7730 | sources."@polymer/iron-meta-3.0.1" | |
|
7731 | sources."@polymer/iron-overlay-behavior-3.0.2" | |
|
7732 | sources."@polymer/iron-resizable-behavior-3.0.1" | |
|
7733 | sources."@polymer/iron-validatable-behavior-3.0.1" | |
|
7734 | sources."@polymer/paper-behaviors-3.0.1" | |
|
7735 | sources."@polymer/paper-button-3.0.1" | |
|
7736 | sources."@polymer/paper-ripple-3.0.1" | |
|
7737 | sources."@polymer/paper-spinner-3.0.1" | |
|
7738 | sources."@polymer/paper-styles-3.0.1" | |
|
7739 | sources."@polymer/paper-toast-3.0.1" | |
|
7740 | sources."@polymer/paper-toggle-button-3.0.1" | |
|
7741 | sources."@polymer/paper-tooltip-3.0.1" | |
|
7742 | sources."@polymer/polymer-3.1.0" | |
|
7485 | 7743 | sources."@types/clone-0.1.30" |
|
7486 | 7744 | sources."@types/node-6.14.0" |
|
7487 | 7745 | sources."@types/parse5-2.2.34" |
@@ -7503,6 +7761,8 let | |||
|
7503 | 7761 | sources."@webassemblyjs/wasm-parser-1.7.10" |
|
7504 | 7762 | sources."@webassemblyjs/wast-parser-1.7.10" |
|
7505 | 7763 | sources."@webassemblyjs/wast-printer-1.7.10" |
|
7764 | sources."@webcomponents/shadycss-1.5.2" | |
|
7765 | sources."@webcomponents/webcomponentsjs-2.1.3" | |
|
7506 | 7766 | sources."@xtuc/ieee754-1.2.0" |
|
7507 | 7767 | sources."@xtuc/long-4.2.1" |
|
7508 | 7768 | sources."abbrev-1.1.1" |
@@ -7716,7 +7976,7 let | |||
|
7716 | 7976 | sources."browserslist-1.7.7" |
|
7717 | 7977 | ]; |
|
7718 | 7978 | }) |
|
7719 |
sources."caniuse-db-1.0.30000 |
|
|
7979 | sources."caniuse-db-1.0.30000900" | |
|
7720 | 7980 | sources."caniuse-lite-1.0.30000899" |
|
7721 | 7981 | sources."caseless-0.12.0" |
|
7722 | 7982 | sources."center-align-0.1.3" |
This diff has been collapsed as it changes many lines, (1003 lines changed) Show them Hide them | |||
@@ -1,39 +1,8 | |||
|
1 | <link rel="import" href="../../../../../../bower_components/polymer/polymer.html"> | |
|
2 | <link rel="import" href="../../../../../../bower_components/iron-ajax/iron-ajax.html"> | |
|
3 | ||
|
4 | <!-- | |
|
5 | ||
|
6 | `<channelstream-connection>` allows you to connect and interact with channelstream server | |
|
7 | abstracting websocket/long-polling connections from you. | |
|
8 | ||
|
9 | In typical use, just slap some `<channelstream-connection>` at the top of your body: | |
|
1 | import {Polymer, html} from '@polymer/polymer/polymer-legacy'; | |
|
2 | import '@polymer/iron-ajax/iron-ajax.js'; | |
|
10 | 3 | |
|
11 | <body> | |
|
12 | <channelstream-connection | |
|
13 | username="{{user.username}}" | |
|
14 | connect-url="http://127.0.0.1:8000/demo/connect" | |
|
15 | disconnect-url="http://127.0.0.1:8000/disconnect" | |
|
16 | subscribe-url="http://127.0.0.1:8000/demo/subscribe" | |
|
17 | message-url="http://127.0.0.1:8000/demo/message" | |
|
18 | long-poll-url="http://127.0.0.1:8000/listen" | |
|
19 | websocket-url="http://127.0.0.1:8000/ws" | |
|
20 | channels-url='["channel1", "channel2"]' /> | |
|
21 | ||
|
22 | Then you can do `channelstreamElem.connect()` to kick off your connection. | |
|
23 | This element also handles automatic reconnections. | |
|
24 | ||
|
25 | ## Default handlers | |
|
26 | ||
|
27 | By default element has a listener attached that will fire `startListening()` handler on `channelstream-connected` event. | |
|
28 | ||
|
29 | By default element has a listener attached that will fire `retryConnection()` handler on `channelstream-connect-error` event, | |
|
30 | this handler will forever try to re-establish connection to the server incrementing intervals between retries up to 1 minute. | |
|
31 | ||
|
32 | --> | |
|
33 | <dom-module id="channelstream-connection"> | |
|
34 | <template> | |
|
35 | ||
|
36 | <iron-ajax | |
|
4 | const elemTemplate = html` | |
|
5 | <iron-ajax | |
|
37 | 6 | id="ajaxConnect" |
|
38 | 7 | url="" |
|
39 | 8 | handle-as="json" |
@@ -45,7 +14,7 this handler will forever try to re-esta | |||
|
45 | 14 | on-error="_handleConnectError" |
|
46 | 15 | debounce-duration="100"></iron-ajax> |
|
47 | 16 | |
|
48 |
|
|
|
17 | <iron-ajax | |
|
49 | 18 | id="ajaxDisconnect" |
|
50 | 19 | url="" |
|
51 | 20 | handle-as="json" |
@@ -56,7 +25,7 this handler will forever try to re-esta | |||
|
56 | 25 | on-response="_handleDisconnect" |
|
57 | 26 | debounce-duration="100"></iron-ajax> |
|
58 | 27 | |
|
59 |
|
|
|
28 | <iron-ajax | |
|
60 | 29 | id="ajaxSubscribe" |
|
61 | 30 | url="" |
|
62 | 31 | handle-as="json" |
@@ -67,7 +36,7 this handler will forever try to re-esta | |||
|
67 | 36 | on-response="_handleSubscribe" |
|
68 | 37 | debounce-duration="100"></iron-ajax> |
|
69 | 38 | |
|
70 |
|
|
|
39 | <iron-ajax | |
|
71 | 40 | id="ajaxUnsubscribe" |
|
72 | 41 | url="" |
|
73 | 42 | handle-as="json" |
@@ -78,7 +47,7 this handler will forever try to re-esta | |||
|
78 | 47 | on-response="_handleUnsubscribe" |
|
79 | 48 | debounce-duration="100"></iron-ajax> |
|
80 | 49 | |
|
81 |
|
|
|
50 | <iron-ajax | |
|
82 | 51 | id="ajaxMessage" |
|
83 | 52 | url="" |
|
84 | 53 | handle-as="json" |
@@ -90,7 +59,7 this handler will forever try to re-esta | |||
|
90 | 59 | on-error="_handleMessageError" |
|
91 | 60 | debounce-duration="100"></iron-ajax> |
|
92 | 61 | |
|
93 |
|
|
|
62 | <iron-ajax | |
|
94 | 63 | id="ajaxListen" |
|
95 | 64 | url="" |
|
96 | 65 | handle-as="text" |
@@ -100,511 +69,509 this handler will forever try to re-esta | |||
|
100 | 69 | on-error="_handleListenError" |
|
101 | 70 | on-response="_handleListenMessageEvent" |
|
102 | 71 | debounce-duration="100"></iron-ajax> |
|
103 | ||
|
104 | </template> | |
|
105 | <script> | |
|
106 | Polymer({ | |
|
107 | is: 'channelstream-connection', | |
|
72 | ` | |
|
108 | 73 | |
|
109 | /** | |
|
110 | * Fired when `channels` array changes. | |
|
111 | * | |
|
112 | * @event channelstream-channels-changed | |
|
113 | */ | |
|
74 | Polymer({ | |
|
75 | is: 'channelstream-connection', | |
|
114 | 76 | |
|
115 | /** | |
|
116 | * Fired when `connect()` method succeeds. | |
|
117 | * | |
|
118 | * @event channelstream-connected | |
|
119 | */ | |
|
77 | _template: elemTemplate, | |
|
120 | 78 | |
|
121 |
|
|
|
122 |
|
|
|
123 |
|
|
|
124 |
|
|
|
125 |
|
|
|
126 | ||
|
127 | /** | |
|
128 | * Fired when `disconnect()` succeeds. | |
|
129 | * | |
|
130 | * @event channelstream-disconnected | |
|
131 | */ | |
|
79 | /** | |
|
80 | * Fired when `channels` array changes. | |
|
81 | * | |
|
82 | * @event channelstream-channels-changed | |
|
83 | */ | |
|
132 | 84 | |
|
133 |
|
|
|
134 |
|
|
|
135 |
|
|
|
136 |
|
|
|
137 |
|
|
|
138 | ||
|
139 | /** | |
|
140 | * Fired when `message()` fails. | |
|
141 | * | |
|
142 | * @event channelstream-message-error | |
|
143 | */ | |
|
85 | /** | |
|
86 | * Fired when `connect()` method succeeds. | |
|
87 | * | |
|
88 | * @event channelstream-connected | |
|
89 | */ | |
|
144 | 90 | |
|
145 |
|
|
|
146 |
|
|
|
147 |
|
|
|
148 |
|
|
|
149 |
|
|
|
150 | ||
|
151 | /** | |
|
152 | * Fired when `subscribe()` fails. | |
|
153 | * | |
|
154 | * @event channelstream-subscribe-error | |
|
155 | */ | |
|
91 | /** | |
|
92 | * Fired when `connect` fails. | |
|
93 | * | |
|
94 | * @event channelstream-connect-error | |
|
95 | */ | |
|
156 | 96 | |
|
157 |
|
|
|
158 |
|
|
|
159 |
|
|
|
160 |
|
|
|
161 |
|
|
|
162 | ||
|
163 | /** | |
|
164 | * Fired when `unsubscribe()` fails. | |
|
165 | * | |
|
166 | * @event channelstream-unsubscribe-error | |
|
167 | */ | |
|
97 | /** | |
|
98 | * Fired when `disconnect()` succeeds. | |
|
99 | * | |
|
100 | * @event channelstream-disconnected | |
|
101 | */ | |
|
168 | 102 | |
|
169 |
|
|
|
170 | * Fired when listening connection receives a message. | |
|
171 |
|
|
|
172 |
|
|
|
173 |
|
|
|
174 | ||
|
175 | /** | |
|
176 | * Fired when listening connection is opened. | |
|
177 | * | |
|
178 | * @event channelstream-listen-opened | |
|
179 | */ | |
|
103 | /** | |
|
104 | * Fired when `message()` succeeds. | |
|
105 | * | |
|
106 | * @event channelstream-message-sent | |
|
107 | */ | |
|
180 | 108 | |
|
181 |
|
|
|
182 | * Fired when listening connection is closed. | |
|
183 |
|
|
|
184 |
|
|
|
185 |
|
|
|
109 | /** | |
|
110 | * Fired when `message()` fails. | |
|
111 | * | |
|
112 | * @event channelstream-message-error | |
|
113 | */ | |
|
186 | 114 | |
|
187 |
|
|
|
188 | * Fired when listening connection suffers an error. | |
|
189 |
|
|
|
190 |
|
|
|
191 |
|
|
|
115 | /** | |
|
116 | * Fired when `subscribe()` succeeds. | |
|
117 | * | |
|
118 | * @event channelstream-subscribed | |
|
119 | */ | |
|
192 | 120 | |
|
193 | properties: { | |
|
194 | isReady: Boolean, | |
|
195 | /** List of channels user should be subscribed to. */ | |
|
196 | channels: { | |
|
197 | type: Array, | |
|
198 | value: function () { | |
|
199 | return [] | |
|
200 | }, | |
|
201 | notify: true | |
|
202 | }, | |
|
203 | /** Username of connecting user. */ | |
|
204 | username: { | |
|
205 | type: String, | |
|
206 | value: 'Anonymous', | |
|
207 | reflectToAttribute: true | |
|
208 | }, | |
|
209 | /** Connection identifier. */ | |
|
210 | connectionId: { | |
|
211 | type: String, | |
|
212 | reflectToAttribute: true | |
|
213 | }, | |
|
214 | /** Websocket instance. */ | |
|
215 | websocket: { | |
|
216 | type: Object, | |
|
217 | value: null | |
|
218 | }, | |
|
219 | /** Websocket connection url. */ | |
|
220 | websocketUrl: { | |
|
221 | type: String, | |
|
222 | value: '' | |
|
223 | }, | |
|
224 | /** URL used in `connect()`. */ | |
|
225 | connectUrl: { | |
|
226 | type: String, | |
|
227 | value: '' | |
|
228 | }, | |
|
229 | /** URL used in `disconnect()`. */ | |
|
230 | disconnectUrl: { | |
|
231 | type: String, | |
|
232 | value: '' | |
|
233 | }, | |
|
234 | /** URL used in `subscribe()`. */ | |
|
235 | subscribeUrl: { | |
|
236 | type: String, | |
|
237 | value: '' | |
|
238 | }, | |
|
239 | /** URL used in `unsubscribe()`. */ | |
|
240 | unsubscribeUrl: { | |
|
241 | type: String, | |
|
242 | value: '' | |
|
243 | }, | |
|
244 | /** URL used in `message()`. */ | |
|
245 | messageUrl: { | |
|
246 | type: String, | |
|
247 | value: '' | |
|
248 | }, | |
|
249 | /** Long-polling connection url. */ | |
|
250 | longPollUrl: { | |
|
251 | type: String, | |
|
252 | value: '' | |
|
253 | }, | |
|
254 | /** Long-polling connection url. */ | |
|
255 | shouldReconnect: { | |
|
256 | type: Boolean, | |
|
257 | value: true | |
|
258 | }, | |
|
259 | /** Should send heartbeats. */ | |
|
260 | heartbeats: { | |
|
261 | type: Boolean, | |
|
262 | value: true | |
|
263 | }, | |
|
264 | /** How much should every retry interval increase (in milliseconds) */ | |
|
265 | increaseBounceIv: { | |
|
266 | type: Number, | |
|
267 | value: 2000 | |
|
268 | }, | |
|
269 | _currentBounceIv: { | |
|
270 | type: Number, | |
|
271 | reflectToAttribute: true, | |
|
272 | value: 0 | |
|
273 | }, | |
|
274 | /** Should use websockets or long-polling by default */ | |
|
275 | useWebsocket: { | |
|
276 | type: Boolean, | |
|
277 | reflectToAttribute: true, | |
|
278 | value: true | |
|
279 | }, | |
|
280 | connected: { | |
|
281 | type: Boolean, | |
|
282 | reflectToAttribute: true, | |
|
283 | value: false | |
|
284 | } | |
|
285 | }, | |
|
121 | /** | |
|
122 | * Fired when `subscribe()` fails. | |
|
123 | * | |
|
124 | * @event channelstream-subscribe-error | |
|
125 | */ | |
|
126 | ||
|
127 | /** | |
|
128 | * Fired when `unsubscribe()` succeeds. | |
|
129 | * | |
|
130 | * @event channelstream-unsubscribed | |
|
131 | */ | |
|
132 | ||
|
133 | /** | |
|
134 | * Fired when `unsubscribe()` fails. | |
|
135 | * | |
|
136 | * @event channelstream-unsubscribe-error | |
|
137 | */ | |
|
138 | ||
|
139 | /** | |
|
140 | * Fired when listening connection receives a message. | |
|
141 | * | |
|
142 | * @event channelstream-listen-message | |
|
143 | */ | |
|
286 | 144 | |
|
287 | observers: [ | |
|
288 | '_handleChannelsChange(channels.splices)' | |
|
289 | ], | |
|
145 | /** | |
|
146 | * Fired when listening connection is opened. | |
|
147 | * | |
|
148 | * @event channelstream-listen-opened | |
|
149 | */ | |
|
290 | 150 | |
|
291 | listeners: { | |
|
292 | 'channelstream-connected': 'startListening', | |
|
293 | 'channelstream-connect-error': 'retryConnection', | |
|
294 | }, | |
|
151 | /** | |
|
152 | * Fired when listening connection is closed. | |
|
153 | * | |
|
154 | * @event channelstream-listen-closed | |
|
155 | */ | |
|
295 | 156 | |
|
296 |
|
|
|
297 | * Mutators hold functions that you can set locally to change the data | |
|
298 | * that the client is sending to all endpoints | |
|
299 | * you can call it like `elem.mutators('connect', yourFunc())` | |
|
300 | * mutators will be executed in order they were pushed onto arrays | |
|
301 | * | |
|
302 | */ | |
|
303 | mutators: { | |
|
304 | connect: function () { | |
|
305 | return [] | |
|
306 | }(), | |
|
307 | message: function () { | |
|
308 | return [] | |
|
309 | }(), | |
|
310 | subscribe: function () { | |
|
311 | return [] | |
|
312 | }(), | |
|
313 | unsubscribe: function () { | |
|
314 | return [] | |
|
315 | }(), | |
|
316 | disconnect: function () { | |
|
317 | return [] | |
|
318 | }() | |
|
319 | }, | |
|
320 | ready: function () { | |
|
321 | this.isReady = true; | |
|
322 | }, | |
|
157 | /** | |
|
158 | * Fired when listening connection suffers an error. | |
|
159 | * | |
|
160 | * @event channelstream-listen-error | |
|
161 | */ | |
|
323 | 162 | |
|
324 | /** | |
|
325 | * Connects user and fetches connection id from the server. | |
|
326 | * | |
|
327 | */ | |
|
328 | connect: function () { | |
|
329 | var request = this.$['ajaxConnect']; | |
|
330 |
re |
|
|
331 | request.body = { | |
|
332 | username: this.username, | |
|
333 | channels: this.channels | |
|
334 | }; | |
|
335 | for (var i = 0; i < this.mutators.connect.length; i++) { | |
|
336 | this.mutators.connect[i](request); | |
|
337 | } | |
|
338 | request.generateRequest() | |
|
339 | }, | |
|
340 | /** | |
|
341 | * Overwrite with custom function that will | |
|
342 | */ | |
|
343 | addMutator: function (type, func) { | |
|
344 | this.mutators[type].push(func); | |
|
163 | properties: { | |
|
164 | isReady: Boolean, | |
|
165 | /** List of channels user should be subscribed to. */ | |
|
166 | channels: { | |
|
167 | type: Array, | |
|
168 | value: function () { | |
|
169 | return [] | |
|
345 | 170 | }, |
|
346 |
|
|
|
347 | * Subscribes user to channels. | |
|
348 | * | |
|
349 | */ | |
|
350 | subscribe: function (channels) { | |
|
351 | var request = this.$['ajaxSubscribe']; | |
|
352 | request.url = this.subscribeUrl; | |
|
353 | request.body = { | |
|
354 | channels: channels, | |
|
355 | conn_id: this.connectionId | |
|
356 |
|
|
|
357 | for (var i = 0; i < this.mutators.subscribe.length; i++) { | |
|
358 | this.mutators.subscribe[i](request); | |
|
359 | } | |
|
360 | if (request.body.channels.length) { | |
|
361 | request.generateRequest(); | |
|
362 |
|
|
|
363 |
|
|
|
364 | /** | |
|
365 | * Unsubscribes user from channels. | |
|
366 |
|
|
|
367 |
|
|
|
368 | unsubscribe: function (unsubscribe) { | |
|
369 | var request = this.$['ajaxUnsubscribe']; | |
|
171 | notify: true | |
|
172 | }, | |
|
173 | /** Username of connecting user. */ | |
|
174 | username: { | |
|
175 | type: String, | |
|
176 | value: 'Anonymous', | |
|
177 | reflectToAttribute: true | |
|
178 | }, | |
|
179 | /** Connection identifier. */ | |
|
180 | connectionId: { | |
|
181 | type: String, | |
|
182 | reflectToAttribute: true | |
|
183 | }, | |
|
184 | /** Websocket instance. */ | |
|
185 | websocket: { | |
|
186 | type: Object, | |
|
187 | value: null | |
|
188 | }, | |
|
189 | /** Websocket connection url. */ | |
|
190 | websocketUrl: { | |
|
191 | type: String, | |
|
192 | value: '' | |
|
193 | }, | |
|
194 | /** URL used in `connect()`. */ | |
|
195 | connectUrl: { | |
|
196 | type: String, | |
|
197 | value: '' | |
|
198 | }, | |
|
199 | /** URL used in `disconnect()`. */ | |
|
200 | disconnectUrl: { | |
|
201 | type: String, | |
|
202 | value: '' | |
|
203 | }, | |
|
204 | /** URL used in `subscribe()`. */ | |
|
205 | subscribeUrl: { | |
|
206 | type: String, | |
|
207 | value: '' | |
|
208 | }, | |
|
209 | /** URL used in `unsubscribe()`. */ | |
|
210 | unsubscribeUrl: { | |
|
211 | type: String, | |
|
212 | value: '' | |
|
213 | }, | |
|
214 | /** URL used in `message()`. */ | |
|
215 | messageUrl: { | |
|
216 | type: String, | |
|
217 | value: '' | |
|
218 | }, | |
|
219 | /** Long-polling connection url. */ | |
|
220 | longPollUrl: { | |
|
221 | type: String, | |
|
222 | value: '' | |
|
223 | }, | |
|
224 | /** Long-polling connection url. */ | |
|
225 | shouldReconnect: { | |
|
226 | type: Boolean, | |
|
227 | value: true | |
|
228 | }, | |
|
229 | /** Should send heartbeats. */ | |
|
230 | heartbeats: { | |
|
231 | type: Boolean, | |
|
232 | value: true | |
|
233 | }, | |
|
234 | /** How much should every retry interval increase (in milliseconds) */ | |
|
235 | increaseBounceIv: { | |
|
236 | type: Number, | |
|
237 | value: 2000 | |
|
238 | }, | |
|
239 | _currentBounceIv: { | |
|
240 | type: Number, | |
|
241 | reflectToAttribute: true, | |
|
242 | value: 0 | |
|
243 | }, | |
|
244 | /** Should use websockets or long-polling by default */ | |
|
245 | useWebsocket: { | |
|
246 | type: Boolean, | |
|
247 | reflectToAttribute: true, | |
|
248 | value: true | |
|
249 | }, | |
|
250 | connected: { | |
|
251 | type: Boolean, | |
|
252 | reflectToAttribute: true, | |
|
253 | value: false | |
|
254 | } | |
|
255 | }, | |
|
370 | 256 | |
|
371 | request.url = this.unsubscribeUrl; | |
|
372 | request.body = { | |
|
373 | channels: unsubscribe, | |
|
374 | conn_id: this.connectionId | |
|
375 | }; | |
|
376 | for (var i = 0; i < this.mutators.unsubscribe.length; i++) { | |
|
377 | this.mutators.unsubscribe[i](request); | |
|
378 | } | |
|
379 | request.generateRequest() | |
|
380 | }, | |
|
257 | observers: [ | |
|
258 | '_handleChannelsChange(channels.splices)' | |
|
259 | ], | |
|
381 | 260 | |
|
382 | /** | |
|
383 | * calculates list of channels we should add user to based on difference | |
|
384 | * between channels property and passed channel list | |
|
385 | */ | |
|
386 | calculateSubscribe: function (channels) { | |
|
387 | var currentlySubscribed = this.channels; | |
|
388 | var toSubscribe = []; | |
|
389 | for (var i = 0; i < channels.length; i++) { | |
|
390 | if (currentlySubscribed.indexOf(channels[i]) === -1) { | |
|
391 | toSubscribe.push(channels[i]); | |
|
392 | } | |
|
393 | } | |
|
394 | return toSubscribe | |
|
395 | }, | |
|
396 |
|
|
|
397 | * calculates list of channels we should remove user from based difference | |
|
398 | * between channels property and passed channel list | |
|
399 |
|
|
|
400 | calculateUnsubscribe: function (channels) { | |
|
401 | var currentlySubscribed = this.channels; | |
|
402 |
|
|
|
403 | for (var i = 0; i < channels.length; i++) { | |
|
404 | if (currentlySubscribed.indexOf(channels[i]) !== -1) { | |
|
405 | toUnsubscribe.push(channels[i]); | |
|
406 | } | |
|
407 | } | |
|
408 |
|
|
|
409 |
|
|
|
410 | /** | |
|
411 | * Marks the connection as expired. | |
|
412 | * | |
|
413 | */ | |
|
414 | disconnect: function () { | |
|
415 | var request = this.$['ajaxDisconnect']; | |
|
416 | request.url = this.disconnectUrl; | |
|
417 | request.params = { | |
|
418 | conn_id: this.connectionId | |
|
419 | }; | |
|
420 | for (var i = 0; i < this.mutators.disconnect.length; i++) { | |
|
421 | this.mutators.disconnect[i](request); | |
|
422 | } | |
|
423 | // mark connection as expired | |
|
424 | request.generateRequest(); | |
|
425 | // disconnect existing connection | |
|
426 | this.closeConnection(); | |
|
427 | }, | |
|
261 | listeners: { | |
|
262 | 'channelstream-connected': 'startListening', | |
|
263 | 'channelstream-connect-error': 'retryConnection', | |
|
264 | }, | |
|
265 | ||
|
266 | /** | |
|
267 | * Mutators hold functions that you can set locally to change the data | |
|
268 | * that the client is sending to all endpoints | |
|
269 | * you can call it like `elem.mutators('connect', yourFunc())` | |
|
270 | * mutators will be executed in order they were pushed onto arrays | |
|
271 | * | |
|
272 | */ | |
|
273 | mutators: { | |
|
274 | connect: function () { | |
|
275 | return [] | |
|
276 | }(), | |
|
277 | message: function () { | |
|
278 | return [] | |
|
279 | }(), | |
|
280 | subscribe: function () { | |
|
281 | return [] | |
|
282 | }(), | |
|
283 | unsubscribe: function () { | |
|
284 | return [] | |
|
285 | }(), | |
|
286 | disconnect: function () { | |
|
287 | return [] | |
|
288 | }() | |
|
289 | }, | |
|
290 | ready: function () { | |
|
291 | this.isReady = true; | |
|
292 | }, | |
|
293 | ||
|
294 | /** | |
|
295 | * Connects user and fetches connection id from the server. | |
|
296 | * | |
|
297 | */ | |
|
298 | connect: function () { | |
|
299 | var request = this.$['ajaxConnect']; | |
|
300 | request.url = this.connectUrl; | |
|
301 | request.body = { | |
|
302 | username: this.username, | |
|
303 | channels: this.channels | |
|
304 | }; | |
|
305 | for (var i = 0; i < this.mutators.connect.length; i++) { | |
|
306 | this.mutators.connect[i](request); | |
|
307 | } | |
|
308 | request.generateRequest() | |
|
309 | }, | |
|
310 | /** | |
|
311 | * Overwrite with custom function that will | |
|
312 | */ | |
|
313 | addMutator: function (type, func) { | |
|
314 | this.mutators[type].push(func); | |
|
315 | }, | |
|
316 | /** | |
|
317 | * Subscribes user to channels. | |
|
318 | * | |
|
319 | */ | |
|
320 | subscribe: function (channels) { | |
|
321 | var request = this.$['ajaxSubscribe']; | |
|
322 | request.url = this.subscribeUrl; | |
|
323 | request.body = { | |
|
324 | channels: channels, | |
|
325 | conn_id: this.connectionId | |
|
326 | }; | |
|
327 | for (var i = 0; i < this.mutators.subscribe.length; i++) { | |
|
328 | this.mutators.subscribe[i](request); | |
|
329 | } | |
|
330 | if (request.body.channels.length) { | |
|
331 | request.generateRequest(); | |
|
332 | } | |
|
333 | }, | |
|
334 | /** | |
|
335 | * Unsubscribes user from channels. | |
|
336 | * | |
|
337 | */ | |
|
338 | unsubscribe: function (unsubscribe) { | |
|
339 | var request = this.$['ajaxUnsubscribe']; | |
|
340 | ||
|
341 | request.url = this.unsubscribeUrl; | |
|
342 | request.body = { | |
|
343 | channels: unsubscribe, | |
|
344 | conn_id: this.connectionId | |
|
345 | }; | |
|
346 | for (var i = 0; i < this.mutators.unsubscribe.length; i++) { | |
|
347 | this.mutators.unsubscribe[i](request); | |
|
348 | } | |
|
349 | request.generateRequest() | |
|
350 | }, | |
|
428 | 351 | |
|
429 |
|
|
|
430 | * Sends a message to the server. | |
|
431 | * | |
|
432 |
|
|
|
433 | message: function (message) { | |
|
434 | var request = this.$['ajaxMessage']; | |
|
435 | request.url = this.messageUrl; | |
|
436 | request.body = message; | |
|
437 | for (var i = 0; i < this.mutators.message.length; i++) { | |
|
438 | this.mutators.message[i](request) | |
|
439 |
|
|
|
440 | request.generateRequest(); | |
|
441 | }, | |
|
442 | /** | |
|
443 | * Opens "long lived" (websocket/longpoll) connection to the channelstream server. | |
|
444 | * | |
|
445 | */ | |
|
446 | startListening: function (event) { | |
|
447 | this.fire('start-listening', {}); | |
|
448 | if (this.useWebsocket) { | |
|
449 | this.useWebsocket = window.WebSocket ? true : false; | |
|
450 | } | |
|
451 | if (this.useWebsocket) { | |
|
452 | this.openWebsocket(); | |
|
453 |
|
|
|
454 | else { | |
|
455 | this.openLongPoll(); | |
|
456 | } | |
|
457 | }, | |
|
458 | /** | |
|
459 | * Opens websocket connection. | |
|
460 | * | |
|
461 | */ | |
|
462 | openWebsocket: function () { | |
|
463 | var url = this.websocketUrl + '?conn_id=' + this.connectionId; | |
|
464 | this.websocket = new WebSocket(url); | |
|
465 | this.websocket.onopen = this._handleListenOpen.bind(this); | |
|
466 | this.websocket.onclose = this._handleListenCloseEvent.bind(this); | |
|
467 | this.websocket.onerror = this._handleListenErrorEvent.bind(this); | |
|
468 | this.websocket.onmessage = this._handleListenMessageEvent.bind(this); | |
|
469 |
|
|
|
470 | /** | |
|
471 | * Opens long-poll connection. | |
|
472 | * | |
|
473 | */ | |
|
474 | openLongPoll: function () { | |
|
475 | var request = this.$['ajaxListen']; | |
|
476 | request.url = this.longPollUrl + '?conn_id=' + this.connectionId; | |
|
477 | request.generateRequest() | |
|
478 | }, | |
|
479 | /** | |
|
480 | * Retries `connect()` call while incrementing interval between tries up to 1 minute. | |
|
481 | * | |
|
482 | */ | |
|
483 | retryConnection: function () { | |
|
484 | if (!this.shouldReconnect) { | |
|
485 | return; | |
|
486 | } | |
|
487 | if (this._currentBounceIv < 60000) { | |
|
488 | this._currentBounceIv = this._currentBounceIv + this.increaseBounceIv; | |
|
489 | } | |
|
490 | else { | |
|
491 | this._currentBounceIv = 60000; | |
|
492 | } | |
|
493 | setTimeout(this.connect.bind(this), this._currentBounceIv); | |
|
494 | }, | |
|
495 | /** | |
|
496 | * Closes listening connection. | |
|
497 | * | |
|
498 | */ | |
|
499 | closeConnection: function () { | |
|
500 | var request = this.$['ajaxListen']; | |
|
501 | if (this.websocket && this.websocket.readyState === WebSocket.OPEN) { | |
|
502 | this.websocket.onclose = null; | |
|
503 | this.websocket.onerror = null; | |
|
504 | this.websocket.close(); | |
|
505 | } | |
|
506 | if (request.loading) { | |
|
507 | request.lastRequest.abort(); | |
|
508 | } | |
|
509 | this.connected = false; | |