Skip to content

fix(core-utils): startLogic was called in incorrect context. #3809

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Hill-98
Copy link

@Hill-98 Hill-98 commented Jan 20, 2025

  • I have read the contribution documentation for this project.
  • I agree to follow the code of conduct that this project follows, as appropriate.
  • The changes are appropriately documented (if applicable).
  • The changes have sufficient test coverage (if applicable).
  • The testsuite passes successfully on my local machine (if applicable).

Summarize your changes:

Fixed startLogic being called in incorrect context.

@Hill-98 Hill-98 requested a review from a team as a code owner January 20, 2025 08:09
Copy link
Member

@erikian erikian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you elaborate on what's the behavior before / after this change? Is this something that can be tested in some way?

@Hill-98
Copy link
Author

Hill-98 commented Mar 22, 2025

The sample code for writing plugins in the documentation currently doesn't work, this change will make it work.

From https://www.electronforge.io/advanced/extending-electron-forge/writing-plugins

export default class MyPlugin extends Pluginbase {
  async startLogic (opts) {
    await this.compileMainProcess();
    return null;
  }

  compileMainProcess () { /* ... */ }
}

newStartFn = plugin.startLogic;: rebind MyPlugin.startLogic function this to undefined.

The official plugin uses all arrow functions, which is fine, but the documentation uses named functions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants