Thanks to visit codestin.com
Credit goes to github.com

Skip to content
/ evw Public

event-driven workflow for cross JS runtime

himself65/evw

Repository files navigation

evw

evw (aka. event &workflow) is a library for building event-driven application in JavaScript/TypeScript.

  • designed for cross-JavaScript runtimes (Node.js, Electron, Browser, Cloudflare Worker, Bun, Deno...)
  • minimal core API
  • written in TypeScript, 100% type and test coverage

Usage

npm i evw

Electron <-> Web Communication

// @file: events.ts
import { defineEvent } from "evw";

export const storeDBEvent = defineEvent<{
  content: string;
}>();
// @file: main.ts
import { storeDBEvent } from "./events";
import { ipcMain } from "evw/electron";

ipcMain.on(storeDBEvent, (event, data) => {
  console.log("Received data from web:", data.content);
});
// @file: app.tsx
import { storeDBEvent } from "./events";
import { sendEvent } from "evw/electron";

export const App = () => {
  const handleClick = () => {
    sendEvent(storeDBEvent, { content: "Hello from Web!" });
  };

  return (
    <div>
      <button onClick={handleClick}>Send Message to Electron</button>
    </div>
  );
};

LICENSE

MIT

About

event-driven workflow for cross JS runtime

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published