Electron's API Docs as Structured Data
· 3 min read
Today we're announcing some improvements to Electron's documentation. Every new release now includes a JSON file that describes all of Electron's public APIs in detail. We created this file to enable developers to use Electron's API documentation in interesting new ways.
Schema overview
Each API is an object with properties like name, description, type, etc.
Classes such as BrowserWindow
and Menu
have additional properties describing
their instance methods, instance properties, instance events, etc.
Here's an excerpt from the schema that describes the BrowserWindow
class:
{
name: 'BrowserWindow',
description: 'Create and control browser windows.',
process: {
main: true,
renderer: false
},
type: 'Class',
instanceName: 'win',
slug: 'browser-window',
websiteUrl: 'https://electronjs.org/docs/api/browser-window',
repoUrl: 'https://github.com/electron/electron/blob/v1.4.0/docs/api/browser-window.md',
staticMethods: [...],
instanceMethods: [...],
instanceProperties: [...],
instanceEvents: [...]
}
And here's an example of a method description, in this case the
apis.BrowserWindow.instanceMethods.setMaximumSize
instance method:
{
name: 'setMaximumSize',
signature: '(width, height)',
description: 'Sets the maximum size of window to width and height.',
parameters: [{
name: 'width',
type: 'Integer'
}, {
name: 'height',
type: 'Integer'
}]
}