Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@karhu/core

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@karhu/core

Core package for Karhu, the lib for powering web app productivity tools

  • 0.2.1
  • npm
  • Socket score

Version published
Weekly downloads
6
increased by200%
Maintainers
1
Weekly downloads
 
Created
Source

@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(input?: string): 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.

Note: Even though this method is synchronous, the .onExec() function is not being called synchronously. It's bering called using setTimeout(fn, 0) to not block further executing.

karhu.runCommand(id: string, input: string): EntryGraph

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

Static Karhu.createCommand

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

Karhu.createCommand (command: UnregisteredCommand): Command

FAQs

Package last updated on 03 Dec 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc