mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-08-16 06:30:22 +03:00
Fix argument passing in the Task
class
This code snippet sets up logging so that a worker process can call `console.log` and its siblings and have them show up in the renderer process’s console… but it’s trying to destructure the antiquated magical `arguments` collection (which is like an array, but isn’t an array!) and the engine doesn’t seem to like it. Logging didn’t work for me until I changed this. This is such a tiny fix, and I don’t have the energy to shelve everything on this branch just to make a separate PR.
This commit is contained in:
parent
3131464ddb
commit
5628d089dc
@ -73,9 +73,9 @@ module.exports = class Task {
|
||||
const env = Object.assign({}, process.env, {userAgent: navigator.userAgent});
|
||||
this.childProcess = ChildProcess.fork(require.resolve('./task-bootstrap'), [compileCachePath, taskPath], { env, silent: true});
|
||||
|
||||
this.on("task:log", () => console.log(...arguments));
|
||||
this.on("task:warn", () => console.warn(...arguments));
|
||||
this.on("task:error", () => console.error(...arguments));
|
||||
this.on("task:log", (...args) => console.log(...args) );
|
||||
this.on("task:warn", (...args) => console.warn(...args) );
|
||||
this.on("task:error", (...args) => console.error(...args));
|
||||
|
||||
this.on("task:deprecations", (deprecations) => {
|
||||
for (let i = 0; i < deprecations.length; i++) {
|
||||
@ -157,7 +157,7 @@ module.exports = class Task {
|
||||
}
|
||||
|
||||
once(eventName, callback) {
|
||||
var disposable = this.on(eventName, function(...args) {
|
||||
var disposable = this.on(eventName, function (...args) {
|
||||
disposable.dispose();
|
||||
callback(...args);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user