开发者社区> 镜像站> NPM> @airglow/plugin-console
@airglow/plugin-console
A plugin for providing console commands to Airglow users.
Last updated 2 months ago by dgrossen .
Apache-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @airglow/plugin-console 
SYNC missed versions from official npm registry.

Airglow Plugin-Console

An Airglow plugin that registers functions that can be executed from the command line. When those functions are called, we'll pass in the current state and dispatcher so that they can be used to provide info to the users.

Installation

npm install --save @airglow/plugin-console

Usage

To enable, add the plugin:

import consolePlugin from '@airglow/console-plugin';

const App = () => (
  <Airglow plugins={{
    consolePlugin()
  }}>
    <AppContainer />
  </Airglow>
);

Configuration options

help: defines the command you want to use to show a list of all available console commands. (help() by default)

Configuring Commands

When you are setting up your modules, you can now pass in consoleCommands:

<AirglowWrapper
  config={{
    consoleCommands: {
      userInfo: {
        description: 'Lists all the information we know about the active user',
        command: ({ state }) => console.log(state.userInfo)
      }
    }
  }}
>
  <App />
</AirglowWrapper>

Now, when you call userInfo() from the command line, the provided command is executed.

The commands are passed an object containing { state, dispatch }. The state is the current state and dispatch is the store's dispatcher.

The provided description is displayed when you enter the help() command in the console.

Current Tags

  • 0.8.0                                ...           latest (2 months ago)

8 Versions

  • 0.8.0                                ...           2 months ago
  • 0.7.0                                ...           7 months ago
  • 0.6.2                                ...           7 months ago
  • 0.6.1                                ...           7 months ago
  • 0.6.0                                ...           7 months ago
  • 0.5.2                                ...           8 months ago
  • 0.5.0                                ...           a year ago
  • 0.4.0                                ...           2 years ago
Maintainers (2)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 24
Dependencies (2)
Dev Dependencies (2)
Dependents (0)
None