Skip to content
/ channo Public

A channel library for Deno that provides Rust-like channels backed by async-cell.

License

Notifications You must be signed in to change notification settings

zebp/channo

Repository files navigation

channo

npm GitHub Workflow Status NPM

A channel library for Deno that provides Rust-like channels backed by async-cell.

Example

import { Channel } from "https://deno.land/x/channo/mod.ts";

const printerChannel = new Channel();

async function listenForMessages() {
  for await (const message of printerChannel.stream()) {
    console.log(message);
  }
}

// Spawns a promise to listen for messages pushed to the channel.
listenForMessages();

printerChannel.push("Hello, world!");

// Sleep for 100ms to allow time for the listener to process the messages.
await new Promise((resolve) => setTimeout(resolve, 100));

About

A channel library for Deno that provides Rust-like channels backed by async-cell.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published