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

hanji

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hanji - npm Package Versions

0.0.5

Diff

alexblokh
published 0.0.4 •

alexblokh
published 0.0.3 •

alexblokh
published 0.0.2 •

Changelog

Source

v0.0.2

Added global onTermite callback to gracefully handle CLI termination

import { onTerminate } from "hanji";

onTerminate((stdin: ReadStream, stdout: WriteStream) => {
  stdout.write(`\ngracefully abort\n^C\n`);
  process.exit(0);
});

32ms throttle for render events

Removed onAttach & onDetach callback functions to be overriden, now we have more node-like api with this.on("attach", (term) => ...). That also provides StateBundles like SelectState ability to directly subscribe to lifecycle events.

Made SelectState generic, not string specific. That provides an ability to write any SelectState you need like:

private readonly data: SelectState<{ label: string; value: string }>;
// or
private readonly data: SelectState<{ label: string; value: {...} }>;

Provided type for keypress events and now render() returns a bundled object

type Prompted<T> =
  | {
      data: undefined;
      status: "aborted";
    }
  | {
      data: T;
      status: "submitted";
    };

so you now can explicitly handle rejections:

const result = await render(new Select(["user1", "user2", "user3", "user4"]));
if (result.status === "aborted") return;
console.log(result.data)

// or you can destructure
const { status, data} = await render(new Select(["user1", "user2", "user3", "user4"]));
if (status === "aborted") return;
console.log(data)

Removed View it's redundant

alexblokh
published 0.0.1 •

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