1.0.0 • Published 5 years ago

@karhu/core v1.0.0

Weekly downloads
11
License
Apache-2.0
Repository
-
Last release
5 years ago

@karhu/core

Karhu is a productivity tool for web applications. This package has the core functionality as the command register and entry graph to adapt command listing to users habits and learn over time.

Install

npm install @karhu/core

Usage

import Karhu from '@karhu/core';

const karhu = new Karhu();

API

Karhu

karhu.addCommand

Adds a command to the current Karhu instance.

karhu.addCommand(command: UnregisteredCommand): Command

karhu.removeCommand

Removes a command from teh current Karhu instance.

karhu.removeCommand(commandId: string): void

karhu.findMatchingCommands

Searches through the existing commands keywords and the current entry graph to find commands that matches the provided input, and returns them.

karhu.findMatchingCommands(): Command[]

karhu.runCommand

Call the command with the provided id's .actions.onExec() function.
Returns the updated entry graph.
The input is needed to better sort the commands next time karhu.findMatchingCommands() is called.

karhu.runCommand(id: string): CommandRunResult

karhu.getCommands

Returns a list of all registered commands for the Karhu instance.

karhu.getCommands(): Command[]

karhu.getEntryGraph

Returns the current Entry Graph for the Karhu instance.

karhu.getEntryGraph(): EntryGraph

karhu.replaceEntryGraph

Overwrites the the current Entry Graph for the Karhu instance with the new one.

karhu.replaceEntryGraph(entryGraph: EntryGraph): void

Static Karhu.createCommand

Makes an UnregisteredCommand -> Command. Mostly used internally but can be useful in some situations.

Karhu.createCommand (command: UnregisteredCommand): Command
1.0.0

5 years ago

0.7.0

5 years ago

0.6.0

5 years ago

0.5.0

5 years ago

0.4.0

5 years ago

0.3.0

5 years ago

0.2.3

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.1.3-alpha.0

5 years ago