Skip to content

Commit

Permalink
feat: add before-load event (#370)
Browse files Browse the repository at this point in the history
* update Electron & TypeScript

* add `before-load` event

* lint
  • Loading branch information
Araxeus authored Apr 11, 2022
1 parent a56f737 commit 3247986
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ The `Menubar` class is an event emitter:

- `ready` - when `menubar`'s tray icon has been created and initialized, i.e. when `menubar` is ready to be used. Note: this is different than Electron app's `ready` event, which happens much earlier in the process
- `create-window` - the line before `new BrowserWindow()` is called
- `after-create-window` - the line after all window init code is done
- `before-load` - after create window, before loadUrl (can be used for `require("@electron/remote/main").enable(webContents)`)
- `after-create-window` - the line after all window init code is done and url was loaded
- `show` - the line before `window.show()` is called
- `after-show` - the line after `window.show()` is called
- `hide` - the line before `window.hide()` is called (on window blur)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"typedoc": "^0.17.7",
"typedoc-plugin-markdown": "^2.2.17",
"typedoc-plugin-no-inherit": "^1.1.10",
"typescript": "^3.9.3"
"typescript": "^4.6.2"
},
"peerDependencies": {
"electron": "^9.0.0 || ^10.0.0 || ^11.0.0 || ^12.0.0 || ^13.0.0 || ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0"
Expand Down
2 changes: 2 additions & 0 deletions src/Menubar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,8 @@ export class Menubar extends EventEmitter {

this._browserWindow.on('close', this.windowClear.bind(this));

this.emit('before-load');

// If the user explicity set options.index to false, we don't loadURL
// https://github.com/maxogden/menubar/issues/255
if (this._options.index !== false) {
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5618,10 +5618,10 @@ typedoc@^0.17.7:
shelljs "^0.8.4"
typedoc-default-themes "^0.10.2"

typescript@^3.9.3:
version "3.9.10"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.10.tgz#70f3910ac7a51ed6bef79da7800690b19bf778b8"
integrity sha512-w6fIxVE/H1PkLKcCPsFqKE7Kv7QUwhU8qQY2MueZXWx5cPZdwFupLgKK3vntcK98BtNHZtAF4LA/yl2a7k8R6Q==
typescript@^4.6.2:
version "4.6.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.6.2.tgz#fe12d2727b708f4eef40f51598b3398baa9611d4"
integrity sha512-HM/hFigTBHZhLXshn9sN37H085+hQGeJHJ/X7LpBWLID/fbc2acUMfU+lGD98X81sKP+pFa9f0DZmCwB9GnbAg==

uglify-js@^3.1.4:
version "3.15.3"
Expand Down

0 comments on commit 3247986

Please sign in to comment.