|
159 | 159 |
|
160 | 160 | this.refs.child.addEventListener('load', () => {
|
161 | 161 | replProxy.onPropUpdate = (prop, value) => {
|
162 |
| - dispatch('binding', { prop, value }); |
163 |
| - values_store.update(values => Object.assign({}, values, { |
164 |
| - [prop]: value |
165 |
| - })); |
| 162 | + const current = { [prop]: value }; |
| 163 | + this.fire('data', { current }); |
166 | 164 | };
|
167 | 165 |
|
168 |
| - replProxy.onFetchProgress = (progress) => { |
169 |
| - pendingImports = progress; |
| 166 | + replProxy.onFetchProgress = pendingImports => { |
| 167 | + this.set({ pendingImports }); |
170 | 168 | };
|
171 | 169 |
|
172 | 170 | replProxy.handleLinks();
|
|
195 | 193 | const destroyComponent = () => {
|
196 | 194 | replProxy.eval(`
|
197 | 195 | if (window.component) {
|
198 |
| - window.component.\$destroy(); |
| 196 | + window.component.\destroy(); |
199 | 197 | window.component = null
|
200 | 198 | }
|
201 | 199 | `);
|
|
249 | 247 |
|
250 | 248 | const { data } = this.get();
|
251 | 249 |
|
| 250 | + console.log('createComponent'); |
| 251 | + |
252 | 252 | replProxy.eval(`${dom.code}
|
253 | 253 | document.body.innerHTML = '';
|
254 | 254 | window.location.hash = '';
|
|
271 | 271 |
|
272 | 272 | this.set({ error });
|
273 | 273 | });
|
274 |
| - |
275 |
| - // Download the imports (sets them on iframe window when complete) |
276 |
| - if (missingImports.length) { |
277 |
| - let cancelled = false; |
278 |
| - promise = replProxy.fetchImports(bundle); |
279 |
| - promise.cancel = () => { cancelled = true }; |
280 |
| - promise.then(() => { |
281 |
| - if (cancelled) return; |
282 |
| - ready(); |
283 |
| - }).catch(error => { |
284 |
| - if (cancelled) return; |
285 |
| - this.set({ error }); |
286 |
| - }); |
287 |
| - } |
288 | 274 | };
|
289 | 275 |
|
290 |
| - let pendingImports = missingImports.length; |
291 |
| - this.set({ pendingImports }); |
| 276 | + this.set({ pendingImports: missingImports.length }); |
292 | 277 |
|
293 | 278 | if (missingImports.length) {
|
294 | 279 | let cancelled = false;
|
295 | 280 |
|
296 |
| - promise = Promise.all( |
297 |
| - missingImports.map(id => fetchImport(id, iframe.contentWindow.curl).then(module => { |
298 |
| - pendingImports -= 1; |
299 |
| - this.set({ pendingImports }); |
300 |
| - return module; |
301 |
| - })) |
302 |
| - ); |
| 281 | + promise = replProxy.fetchImports(bundle, pendingImports => { |
| 282 | + this.set({ pendingImports }); |
| 283 | + }); |
| 284 | + |
303 | 285 | promise.cancel = () => cancelled = true;
|
304 | 286 |
|
305 | 287 | promise
|
|
0 commit comments