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

sydney

v1.0.0

Published

Sydney ======

Downloads

9

Readme

Sydney

Codeship Status for xaviervia/sydney Code Climate Test Coverage

Event Subscription/Venue library. Whole new approach:

  • Asynchronous emission only. Synchronous programming is over.
  • The venue is a middleware. Propagation in the venue is mediated by the main callback.
  • Subscribers are venues too. Broadcasting back into the source venue is done by adding the source venue as a subscriber to its own subscribers (this is called linking).

The way events are treated is completely different. You can think of them as full requests, with headers and payload:

  • There is no difference between the event and the arguments sent to the event. Events are assumed to be complex objects.
  • Optional endpoints allow venues to check whether they are interested in an event or not. This allows venues to link to each other promiscuously and achieve very complex topologies in a scalable manner.

Usage documentation is pending

Installation

npm install --save sydney

Methods

new( [endpoint] [, callback] )

Creates a new Sydney venue. If only a Function is provided, it is used as the callback. If only an Object of any other kind is provided, it is used as the endpoint. If two arguments are provided, the first is used as the endpoint and the second as the callback.

Note that new is completely optional. Calling Sydney as a function directly will have the same effect.

Arguments

  • optional Object endpoint
  • optional Function callback

Returns

  • Sydney this

Sydney.amplify( vanillaSubscriber )

Adds Sydney.prototype methods as mixin to the vanillaSubscriber.

send( event )

If the venue has an endpoint, it calls match with the event and only calls the callback if the return value is true. If there is no endpoint it always calls the callback. The callback is called with the event as the first argument and the venue (this) as the second argument.

If there is no callback, the event is broadcasted to the subscribers instead. That is done by calling broadcast with the event as argument.

Arguments

  • Object event

Returns

  • Sydney this

broadcast( event )

Calls send with the provided event in all the subscribers.

Arguments

  • Object event

Returns

  • Sydney this

add( subscriber )

If the subscriber is a Sydney venue, it just adds it as a subscriber in the current venue.

If the subscriber is not a Sydney module, it adds all of Sydney methods to the subscriber. It doesn't override properties already existing on the subscriber.

Returns

  • Sydney this

remove( subscriber )

Removes the subscriber from the venue.

Arguments

  • Object subscriber

Returns

  • Sydney this

link( subscriber )

If the subscriber is a Sydney venue, it just adds it as a subscriber in the current venue. Then adds the venue back into the subscriber.

If the subscriber is not a Sydney module, it adds all of Sydney methods to the subscriber. It doesn't override properties already existing on the subscriber.

Returns

  • Sydney this

unlink( subscriber )

Removes the subscriber from the venue and removes the venue from the subscriber.

Arguments

  • Object subscriber

Returns

  • Sydney this

Testing

git clone git://github.com/xaviervia/sydney
cd sydney
npm install
make test

License

Copyright 2015 Xavier Via

ISC license.

See LICENSE attached.