@honkjs/honk
TypeScript icon, indicating that this package has built-in type declarations

3.0.0 • Public • Published

Honk

Honk, pronounced "🚚 HONK!" shouted as loudly as possible while making a truck horn pulling motion, is inspired by, and a loud collection of addons for, choo 🚂🚋, the sturdy frontend framework that could.

"Honk", because, by default, that is all that it does.

Package Version
@honkjs/honk npm version
@honkjs/injector npm version
@honkjs/store npm version
@honkjs/silence npm version

Built with 🤣 by Kel and contributors

Getting started

npm install @honkjs/honk
import Honk from '@honkjs/honk';

const honk = new Honk().honk;

honk(); // output: "🚚 HONK!"

Would you like to know more?

With service injection (thunks)

import Honk from '@honkjs/honk';
import injector from '@honkjs/injector';

const honk = new Honk().use(injector()).honk;

honk(); // output: "🚚 HONK!"

function delayedHonk(delay: number) {
  return function({ honk }: IHonkServices) {
    setTimeout(() => honk(), delay);
  };
}

honk(delayedHonk(1000)); // output after 1000ms: "🚚 HONK!"

Would you like to know more?

With custom services

import Honk from '@honkjs/honk';
import injector from '@honkjs/injector';

const honk = new Honk()
  .use(injector({ time: 100 }))
  .honk;

honk(); // output: "🚚 HONK!"

function honkOne({ honk, time }) {
  setTimeout(() => honk(), time);
}

honk(honkOne); // output after 100ms: "🚚 HONK!"

Would you like to know more?

With custom middleware

import Honk from '@honkjs/honk';

function honkingMiddleware(app, next) {
  return function(args) {
    if (args.length === 1 && args[0].type) {
      const honkType = args[0].type;
      if (honkType === 'quiet') {
        return '🚚 HONK!';
      } else {
        return '🚚 HONK!';
      }
    }
    return next(args);
  };
}

const honk = new Honk().use(honkingMiddleware).honk;

honk(); // output: "🚚 HONK!"

const quiet = honk.honk({ type: 'quiet' }); // output: nothing.
// quiet = "🚚 HONK!"

const loud = honk.honk({ type: 'loud' }); // output: nothing.
// loud = "🚚 HONK!"

Would you like to know more?

With silence

import Honk from '@honkjs/honk';
import silence from '@honkjs/silence';

const honk = new Honk().use(silence()).honk;

honk(); // output: Nothing. Just the silence of your cold, dead heart.

Would you like to know more?

FAQ

Honk?

🚚 HONK!

Readme

Keywords

none

Package Sidebar

Install

npm i @honkjs/honk

Weekly Downloads

2

Version

3.0.0

License

Apache-2.0

Unpacked Size

31.1 kB

Total Files

9

Last publish

Collaborators

  • decoy