npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

channy

v0.1.9

Published

Channy is a Go channel-like observer that allows easy orchestration of arbitrary events

Downloads

7

Readme

channy

Travis NPM Bower

channy is a Go channel-like observer that allows easy orchestration of arbitrary events. It lets you to get rid of binding events to DOM elements (because those aren't very reusable across an application), and instead, lets channy message the members of a channel, executing all of the callbacks that have joined.

As stated above, this is loosely based on the flow associated with Go's channels. I use this library for most of my projects, so I figured I should stop copying and pasting it and start keeping it nice and versioned. :+1:

Install

npm install channy --save

Or with Bower (use dist/channy.pkg.js in browserland),

bower install channy --save

Usage

channy is a static class, so you don't need to instantiate it with new. It is responsible for managing global channels. A channel name should be namespaced (for example, "namespace:channel"). See inline documentation for detailed breakdowns on what each method does, otherwise see below for some basic usage.

chan = require "channy"

chan.join "chan:channy", (x) ->
  console.log "hello, #{x}"

chan.message "chan:channy", "channy"
# console.log => "hello, channy"

Open a channel

Open up an empty channel. open takes a channel name and returns void.

chan.open "a:channel"

Close a channel

Close a channel. close takes a channel name and returns void.

chan.close "a:channel"

Join a channel

Join a channel. This will automatically create the channel if it doesn't already exist. join takes a channel name and callback function and returns the callback.

chan.join "a:channel", (args...) -> # ...

Leave a channel

Leave a channel. This will automatically close the channel if no subscribers currently exist for it. leave takes a channel name and callback function and returns the callback.

callback = -> # ...

chan.join "a:channel", callback

chan.leave "a:channel", callback

Message a channel

Send a message to a channel, executing all callbacks currently subscribed. message takes a channel name and an infinite number of arguments to be passed to the callback function, and returns void.

chan.join "a:channel", (x) -> console.log "hello, #{x}"

chan.message "a:channel", "channy"
# console.log => "hello, channy"

chan.message "a:channel", "manny"
# console.log => "hello, manny"

License

MIT © Ezekiel Gabrielse