Π·Π΅Ρ€ΠΊΠ°Π»ΠΎ ΠΈΠ·
1
0
Π€ΠΎΡ€ΠΊΠ½ΡƒΡ‚ΡŒ 0
πŸ“ Electron's API documentation in a structured JSON format [ARCHIVED]
ΠŸΠ΅Ρ€Π΅ΠΉΡ‚ΠΈ ΠΊ Ρ„Π°ΠΉΠ»Ρƒ
Zeke Sikelianos a19afe27d5
add retirement warning to readme
2018-04-03 14:10:36 -07:00
.gitignore ignore stuff 2016-09-23 12:35:57 -07:00
.travis.yml add travis and attempt to support node 4 2016-09-23 12:08:25 -07:00
build.js add a requirable tree of API docs 2016-10-26 16:49:36 -07:00
electron-api.json API docs for Electron 1.6.15 2017-10-18 01:04:05 +00:00
index.js all that basics in place 2016-09-22 16:02:20 -07:00
package.json API docs for Electron 1.6.15 2017-10-18 01:04:05 +00:00
readme.md add retirement warning to readme 2018-04-03 14:10:36 -07:00
release.sh create git tag manually 2016-09-23 12:57:35 -07:00
test.js add a requirable tree of API docs 2016-10-26 16:49:36 -07:00
tree.json add a requirable tree of API docs 2016-10-26 16:49:36 -07:00

readme.md

🚧 THIS PROJECT IS NO LONGER MAINTAINED. To get the latest version of Electron's structured docs, see the electron-api.json artifact in any Electron releaase: https://github.com/electron/electron/releases

electron-api-docs Build Status

Electron's API documentation in a structured JSON format.

Installation

npm install electron-api-docs --save

Or take it for a spin in your Node.js REPL:

npm i -g trymodule && trymodule electron-api-docs=apis

Note: This package is not semantically versioned. It is published in step with Electron. When you install electron-api-docs@1.4.1, you're getting the API docs from Electron v1.4.1.

Usage

This module exports structured API data in a few different formats. Choose the one that works best for your use case:

Object Tree Structure

To access the docs as a big object tree:

const apis = require('electron-api-docs/tree')

This gives you an object with keys for easy traversal:

apis.BrowserWindow.instanceMethods.setAspectRatio

Array Structure

To access the docs as an array of API objects:

const apis = require('electron-api-docs/electron-api.json')

This gives you an array of API objects, so functional methods like find, map, filter, and every can be used:

apis.find(api => api.name === 'BrowserWindow')
apis.filter(api => api.type === 'Class')
apis.filter(api => api.type === 'Module')
apis.map(api => api.name)

Keyed Array Structure

For the best of both worlds (arrays and objects), you can require the module as a keyed array:

const apis = require('electron-api-docs')

When you require it, you get an array of API objects

apis.length
// => 33

The array has a key for each API name, for convenient access:

apis.BrowserWindow
apis.BrowserWindow.staticMethods.getAllWindows.description
apis.WebContents.instanceMethods.savePage.parameters.saveType.possibleValues
apis.app.events.quit

All of the arrays have named keys, but they're still actually arrays, so functional methods like find, map, filter, and every can be used:

apis.find(api => api.name === 'BrowserWindow')
apis.filter(api => api.type === 'Class')
apis.filter(api => api.type === 'Module')
apis.map(api => api.name)

// All arrays have named keys, not just the top-level array!
apis.BrowserWindow.instanceMethods.map(method => method.name)

Tests

npm install
npm test

Dependencies

  • keyed-array: Recursively add named keys to arrays of objects

Dev Dependencies

  • chai: BDD/TDD assertion library for node.js and the browser. Test framework agnostic.
  • gh-latest-release: Get the latest published full release for the Github repository
  • json: a 'json' command for massaging and processing JSON on the command line
  • mocha: simple, flexible, fun test framework
  • standard: JavaScript Standard Style
  • standard-markdown: Test your Markdown files for Standard JavaScript Styleβ„’

License

MIT