1.0.6 • Published 3 years ago

sanajk v1.0.6

Weekly downloads
4
License
Zlib
Repository
github
Last release
3 years ago

SanaJK

npm npm license npm download total npm download by month npm type definitions

Dependency Status devDependency Status build

Ukagaka SHIORI subsystem 'SanaJK'

see also create-sanajk-ghost

Install

npm:

npm install sanajk

Usage

import * as SanaJK from "sanajk";

const r = String.raw;
const myState = {
  bar: "bar",
  day: 0, // Sunday
};

const builder = new SanaJK.SanaShioriBuilder()
  .use({ state: myState })
  .useDefaults();

const events = builder.state.events;
events.OnBoot = () => r`\0\s[0]Boot!\e`;
events.OnMyEvent = (ctx) => r`\0\s[0]foo ${ctx.state.bar} baz\e`;

const { auto, autow, chain } = SanaJK;
const autoTalks = builder.state.autoTalks;
autoTalks.add(
  r`\0\s[0]random talk!\e`,
  auto(["tag1"], r`\0\s[0]tagged random talk!\e`),
  autow(5, r`\0\s[0]weight grouped random talk!\e`, r`\0\s[0]one more!\e`),
  autow(
    (ctx) => (new Date().getDay() === ctx.state.day ? 1 : 0),
    (ctx) => r`\0\s[0]Today is day=${ctx.state.day}!\e`
  ),
  chain(
    r`\0\s[0]chain talk!\e`,
    auto(
      chain(r`\0\s[0]nested chain talk 1!\e`, r`\0\s[0]one more!\e`),
      chain(r`\0\s[0]nested chain talk 2!\e`, r`\0\s[0]one more!\e`)
    ),
    r`\0\s[0]done!\e`
  )
);

export = builder.build();
shiolinkjs ./shiori.js

API

https://narazaka.github.io/sanajk/

License

This is released under Zlib License.

1.0.6

3 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.2.0

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago