| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 /** | 31 /** |
| 32 * @unrestricted | 32 * @unrestricted |
| 33 */ | 33 */ |
| 34 Common.Worker = class { | 34 Common.Worker = class { |
| 35 /** | 35 /** |
| 36 * @param {string} appName | 36 * @param {string} appName |
| 37 */ | 37 */ |
| 38 constructor(appName) { | 38 constructor(appName) { |
| 39 var url = appName + '.js'; | 39 var url = appName + '.js'; |
| 40 var remoteBase = Runtime.queryParam('remoteBase'); | 40 url += Runtime.queryParamsString(); |
| 41 if (remoteBase) | |
| 42 url += '?remoteBase=' + remoteBase; | |
| 43 | 41 |
| 44 /** @type {!Promise<!Worker>} */ | 42 /** @type {!Promise<!Worker>} */ |
| 45 this._workerPromise = new Promise(fulfill => { | 43 this._workerPromise = new Promise(fulfill => { |
| 46 this._worker = new Worker(url); | 44 this._worker = new Worker(url); |
| 47 this._worker.onmessage = onMessage.bind(this); | 45 this._worker.onmessage = onMessage.bind(this); |
| 48 | 46 |
| 49 /** | 47 /** |
| 50 * @param {!Event} event | 48 * @param {!Event} event |
| 51 * @this {Common.Worker} | 49 * @this {Common.Worker} |
| 52 */ | 50 */ |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 this._workerPromise.then(worker => worker.onmessage = listener); | 85 this._workerPromise.then(worker => worker.onmessage = listener); |
| 88 } | 86 } |
| 89 | 87 |
| 90 /** | 88 /** |
| 91 * @param {?function(!Event)} listener | 89 * @param {?function(!Event)} listener |
| 92 */ | 90 */ |
| 93 set onerror(listener) { | 91 set onerror(listener) { |
| 94 this._workerPromise.then(worker => worker.onerror = listener); | 92 this._workerPromise.then(worker => worker.onerror = listener); |
| 95 } | 93 } |
| 96 }; | 94 }; |
| OLD | NEW |