Skip to content

Commit

Permalink
chore: Update docs and bump devDeps (max-mapper#251)
Browse files Browse the repository at this point in the history
* chore: Update docs and bump devDeps

* Typo

* Remove incorrect example

* Remove devDeps badge
  • Loading branch information
amaury1093 authored Oct 23, 2019
1 parent b54dce5 commit 00f3568
Show file tree
Hide file tree
Showing 9 changed files with 98 additions and 144 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ See the reference [API docs](./docs/classes/_menubar_.menubar.md).

## `menubar()` Options

You can pass an optional options object into the `menubar` function:
You can pass an optional options object into the `menubar({ ... })` function:

- `dir` (default `process.cwd()`) - the app source directory
- `index` (default `file:// + opts.dir + index.html`) - the html to load for the pop up window
Expand Down Expand Up @@ -115,11 +115,11 @@ The `Menubar` class is an event emitter:

## Compatibility with Electron

| menubar | Electron |
| -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| 7.x.x | 7.x.x |
| 6.x.x | 4.x.x \| 5.x.x \| 6.x.x (not recommended for [security reasons](https://electronjs.org/docs/tutorial/security#17-use-a-current-version-of-electron)) |
| <= 5.x.x | Please, _please_ don't use these old versions |
| menubar | Electron | Notes |
| -------- | ----------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| 7.x.x | 7.x.x |
| 6.x.x | 4.x.x \| 5.x.x \| 6.x.x | Not recommended for [security reasons](https://electronjs.org/docs/tutorial/security#17-use-a-current-version-of-electron) |
| <= 5.x.x | <= 3.x.x | Please, _please_ don't use these old versions |

## API Docs

Expand Down
13 changes: 11 additions & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
[![dependencies Status](https://david-dm.org/maxogden/menubar/status.svg)](https://david-dm.org/maxogden/menubar)
![npm bundle size](https://img.shields.io/bundlephobia/minzip/menubar.svg)
![npm bundle size](https://img.shields.io/bundlephobia/min/menubar.svg)
[![Buy me a tree](https://img.shields.io/badge/Buy%20me%20a%20tree-%F0%9F%8C%B3-lightgreen)](https://offset.earth/amaurymartiny)

<br /><br /><br />

Expand Down Expand Up @@ -81,7 +82,7 @@ See the reference [API docs](./docs/classes/_menubar_.menubar.md).

## `menubar()` Options

You can pass an optional options object into the `menubar` function:
You can pass an optional options object into the `menubar({ ... })` function:

- `dir` (default `process.cwd()`) - the app source directory
- `index` (default `file:// + opts.dir + index.html`) - the html to load for the pop up window
Expand Down Expand Up @@ -116,6 +117,14 @@ The `Menubar` class is an event emitter:
- `after-close` - after the `.window` (BrowserWindow) property has been deleted
- `focus-lost` - emitted if always-on-top option is set and the user clicks away

## Compatibility with Electron

| menubar | Electron | Notes |
| -------- | ----------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| 7.x.x | 7.x.x |
| 6.x.x | 4.x.x \| 5.x.x \| 6.x.x | Not recommended for [security reasons](https://electronjs.org/docs/tutorial/security#17-use-a-current-version-of-electron) |
| <= 5.x.x | <= 3.x.x | Please, _please_ don't use these old versions |

## API Docs

See the reference [API docs](./docs/globals.md).
Expand All @@ -125,4 +134,4 @@ See the reference [API docs](./docs/globals.md).
- Use `mb.on('after-create-window', callback)` to run things after your app has loaded. For example you could run `mb.window.openDevTools()` to open the developer tools for debugging, or load a different URL with `mb.window.loadUrl()`
- Use `mb.on('focus-lost')` if you would like to perform some operation when using the option `browserWindow.alwaysOnTop: true`
- To restore focus of previous window after menubar hide, use `mb.on('after-hide', () => { mb.app.hide() } )` or similar
- To create a native menu, you can use `tray.setContextMenu(contextMenu)`, and pass this custom tray to menubar: `const mb = menubar({ tray });`. See [this example](./examples/native/menu) for more information.
- To create a native menu, you can use `tray.setContextMenu(contextMenu)`, and pass this custom tray to menubar: `const mb = menubar({ tray });`. See [this example](https://github.com/maxogden/menubar/tree/master/examples/native-menu) for more information.
46 changes: 27 additions & 19 deletions docs/classes/_menubar_.menubar.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,16 @@ The main Menubar class.

### constructor

\+ **new Menubar**(`app`: `App`, `options?`: `Partial<Options>` | string): *[Menubar](_menubar_.menubar.md)*
\+ **new Menubar**(`app`: `App`, `options?`: `Partial<Options>`): *[Menubar](_menubar_.menubar.md)*

*Defined in [Menubar.ts:23](https://github.com/maxogden/menubar/blob/d31ecca/src/Menubar.ts#L23)*
*Defined in [Menubar.ts:24](https://github.com/maxogden/menubar/blob/a8f1477/src/Menubar.ts#L24)*

**Parameters:**

Name | Type |
------ | ------ |
`app` | `App` |
`options?` | `Partial<Options>` \| string |
`options?` | `Partial<Options>` |

**Returns:** *[Menubar](_menubar_.menubar.md)*

Expand All @@ -55,7 +55,7 @@ Name | Type |

**get app**(): *`App`*

*Defined in [Menubar.ts:46](https://github.com/maxogden/menubar/blob/d31ecca/src/Menubar.ts#L46)*
*Defined in [Menubar.ts:47](https://github.com/maxogden/menubar/blob/a8f1477/src/Menubar.ts#L47)*

The Electron [App](https://electronjs.org/docs/api/app)
instance.
Expand All @@ -68,7 +68,7 @@ ___

**get positioner**(): *any*

*Defined in [Menubar.ts:54](https://github.com/maxogden/menubar/blob/d31ecca/src/Menubar.ts#L54)*
*Defined in [Menubar.ts:56](https://github.com/maxogden/menubar/blob/a8f1477/src/Menubar.ts#L56)*

The [electron-positioner](https://github.com/jenslind/electron-positioner)
instance.
Expand All @@ -81,7 +81,7 @@ ___

**get tray**(): *`Tray`*

*Defined in [Menubar.ts:67](https://github.com/maxogden/menubar/blob/d31ecca/src/Menubar.ts#L67)*
*Defined in [Menubar.ts:69](https://github.com/maxogden/menubar/blob/a8f1477/src/Menubar.ts#L69)*

The Electron [Tray](https://electronjs.org/docs/api/tray) instance.

Expand All @@ -91,40 +91,44 @@ ___

### window

**get window**(): *undefined | `BrowserWindow`*
**get window**(): *`BrowserWindow` | undefined*

*Defined in [Menubar.ts:81](https://github.com/maxogden/menubar/blob/d31ecca/src/Menubar.ts#L81)*
*Defined in [Menubar.ts:83](https://github.com/maxogden/menubar/blob/a8f1477/src/Menubar.ts#L83)*

The Electron [BrowserWindow](https://electronjs.org/docs/api/browser-window)
instance, if it's present.

**Returns:** *undefined | `BrowserWindow`*
**Returns:** *`BrowserWindow` | undefined*

## Methods

### getOption

**getOption**(`key`: keyof Options): *undefined | string | number | false | true | `BrowserWindowConstructorOptions` | `NativeImage` | `Tray`*
**getOption**<**K**>(`key`: `K`): *`Options[K]`*

*Defined in [Menubar.ts:90](https://github.com/maxogden/menubar/blob/d31ecca/src/Menubar.ts#L90)*
*Defined in [Menubar.ts:92](https://github.com/maxogden/menubar/blob/a8f1477/src/Menubar.ts#L92)*

Retrieve a menubar option.

**Type parameters:**

**K**: *keyof Options*

**Parameters:**

Name | Type | Description |
------ | ------ | ------ |
`key` | keyof Options | The option key to retrieve, see [Options](../interfaces/_types_.options.md). |
`key` | `K` | The option key to retrieve, see [Options](../interfaces/_types_.options.md). |

**Returns:** *undefined | string | number | false | true | `BrowserWindowConstructorOptions` | `NativeImage` | `Tray`*
**Returns:** *`Options[K]`*

___

### hideWindow

**hideWindow**(): *void*

*Defined in [Menubar.ts:97](https://github.com/maxogden/menubar/blob/d31ecca/src/Menubar.ts#L97)*
*Defined in [Menubar.ts:99](https://github.com/maxogden/menubar/blob/a8f1477/src/Menubar.ts#L99)*

Hide the menubar window.

Expand All @@ -134,18 +138,22 @@ ___

### setOption

**setOption**(`key`: keyof Options, `value`: any): *void*
**setOption**<**K**>(`key`: `K`, `value`: `Options[K]`): *void*

*Defined in [Menubar.ts:116](https://github.com/maxogden/menubar/blob/d31ecca/src/Menubar.ts#L116)*
*Defined in [Menubar.ts:115](https://github.com/maxogden/menubar/blob/a8f1477/src/Menubar.ts#L115)*

Change an option after menubar is created.

**Type parameters:**

**K**: *keyof Options*

**Parameters:**

Name | Type | Description |
------ | ------ | ------ |
`key` | keyof Options | The option key to modify, see [Options](../interfaces/_types_.options.md). |
`value` | any | The value to set. |
`key` | `K` | The option key to modify, see [Options](../interfaces/_types_.options.md). |
`value` | `Options[K]` | The value to set. |

**Returns:** *void*

Expand All @@ -155,7 +163,7 @@ ___

**showWindow**(`trayPos?`: `Electron.Rectangle`): *`Promise<void>`*

*Defined in [Menubar.ts:125](https://github.com/maxogden/menubar/blob/d31ecca/src/Menubar.ts#L125)*
*Defined in [Menubar.ts:124](https://github.com/maxogden/menubar/blob/a8f1477/src/Menubar.ts#L124)*

Show the menubar window.

Expand Down
Loading

0 comments on commit 00f3568

Please sign in to comment.