Skip to content

Commit

Permalink
fix(plugin-compile): bind in constructor to make TS happy
Browse files Browse the repository at this point in the history
  • Loading branch information
MarshallOfSound committed Jul 5, 2018
1 parent ad061fb commit 5cb74d4
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions packages/plugin/compile/src/CompilePlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.