Skip to content

Commit

Permalink
Merge branch 'master' into bryphe/docs/editorlayer-to-bufferlayer
Browse files Browse the repository at this point in the history
  • Loading branch information
bryphe authored Feb 26, 2018
2 parents 93617ec + c4cc2a0 commit 5dc406b
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 3 deletions.
21 changes: 18 additions & 3 deletions INDEX.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,22 @@ This documents the surface area of Oni's API, which is available to both _plugin

A good starting point is the [Plugin API](interfaces/plugin.api.html), which is the object passed into the `activate` methods.

An example `config.js` using the API object is:
The [Plugin API](interfaces/plugin.api.html) is available in a few places:

### Developer Tools

There is a global `Oni` object available in the developer tools:
- Open the command palette and execute `Open Devtools`
- Go to the `Console` tab
- Start executing against the `Oni` object

![example](./../images/devtools-example.png)

This is great for quick debugging or exploring the API surface area.

### User Configuration

An `Oni` API object is passed to the `activate` method of your config. An example `config.js` using the API object is:

```
const activate = (oni) => {
Expand All @@ -16,6 +31,6 @@ module.exports = {
}
```

Likewise, for a plugin, the entry point is an `activate` method with a [Plugin API](interfaces/plugin.api.html) object passed in.

### Plugins

Like the user configuration, for plugins, the entry point is an `activate` method with an Oni object passed in.
Binary file added images/devtools-example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,41 @@ export interface Log {
enableVerboseLogging(): void
}

/**
* The `recorder` API enables the taking of screenshot or recording a video.
*
* The output defaults to the `os.tmpdir()` directory, but can be overridden
* by the `recorder.outputPath` option.
*/
export interface Recorder {

/**
* Returns `true` if a recording is in progress, `false` otherwise
*/
isRecording: boolean

/**
* Start recording a video.
*
* Videos are recorded in `.webm` format.
*/
startRecording(): void

/**
* Stop recording a video.
*
* Optionally specify the destination `fileName`.
*/
stopRecording(fileName?: string): Promise<void>

/**
* Take a screenshot.
*
* Optionally specify the destination `fileName.
*/
takeScreenshot(fileName?: string): void
}

export interface StatusBar {
getItem(globalId?: string): StatusBarItem
createItem(alignment: number, globalId?: string): StatusBarItem
Expand Down Expand Up @@ -468,6 +503,7 @@ export namespace Plugin {
plugins: IPluginManager
menu: Menu.Api
process: Process
recorder: Recorder
statusBar: StatusBar
windows: IWindowManager
workspace: Workspace
Expand Down

0 comments on commit 5dc406b

Please sign in to comment.