Skip to content
Permalink
Browse files

fix(plugin-compile): bind in constructor to make TS happy

  • Loading branch information
MarshallOfSound committed Jul 5, 2018
1 parent ad061fb commit 5cb74d4cf231873dc1c31c04eedb8e2bf664a594
Showing with 11 additions and 3 deletions.
  1. +11 −3 packages/plugin/compile/src/CompilePlugin.ts
@@ -8,18 +8,26 @@ export default class LocalElectronPlugin extends PluginBase<CompilePluginConfig>
name = 'electron-compile';
private dir!: string;

init = (dir: string) => {
constructor(c: CompilePluginConfig) {
super(c);

this.init = this.init.bind(this);
this.getHook = this.getHook.bind(this);
this.startLogic = this.startLogic.bind(this);
}

init(dir: string) {
this.dir = dir;
}

getHook = (hookName: string) => {
getHook(hookName: string) {
if (hookName === 'packageAfterCopy') {
return createCompileHook(this.dir);
}
return null;
}

startLogic = async (opts: StartOptions) => {
async startLogic(opts: StartOptions) {
return [process.execPath, path.resolve(this.dir, 'node_modules/electron-prebuilt-compile/lib/cli')];
}
}

0 comments on commit 5cb74d4

Please sign in to comment.
You can’t perform that action at this time.