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

baconui

v0.3.14

Published

Some helpers for constructing jQuery UIs with Bacon.js. This is stuff that I've extracted from more specific codebases and that's too UI-specific to qualify for inclusion in Bacon.js.

Downloads

6

Readme

Some helpers for constructing jQuery UIs with Bacon.js. This is stuff that I've extracted from more specific codebases and that's too UI-specific to qualify for inclusion in Bacon.js.

Bacon.UI.textFieldValue(textfield)

Returns the value of a textfield (jQuery object) as a Property. Currently bound to keyups, input, cut, paste.

var username = Bacon.UI.textFieldValue($("#username"))

Bacon.UI.optionValue(optionField, initValue)

Returns the value of an option field (jQuery object) as a Property.

Optionally, you can define initValue, which will set it as the initial value of the underlying <select> HTML element.

Example usage:

Given HTML like this:

<select id="doneness-level">
  <option value="raw">Raw doneness level</option>
  <option value="medium">Medium doneness level</option>
</select>

You can do like this:

var baconRoastingLevel = Bacon.UI.optionValue(
  $('#doneness-level'),
  'medium' // Set the select element initially to value "medium"
)

Bacon.UI.checkBoxGroupValue(checkBoxes, initValue)

Returns the value of a checkbox group (jQuery object representing multiple checkboxes) as a Property. The value will be an array containing the values of selected checkboxes. The optional initValue param can be used to set the initial state.

Now suppose you have three checkboxes for selecting the media for customer contacts:

<input type="checkbox" value="email"/>
<input type="checkbox" value="sms"/>
<input type="checkbox" value="snailmail"/>

To set up a property containing selected media, with "sms" initially selected:

var selectedMedia = Bacon.UI.checkBoxGroupValue($("input"), ["sms"])

Bacon.EventStream.ajax(fn)

Performs an AJAX request on each event of your stream, collating results in the result stream.

The source stream is expected to provide the parameters for the AJAX call.

var usernameRequest = username.map(function(un) { return { type: "get", url: "/usernameavailable/" + un } })
var usernameAvailable = username.changes().ajax()

Running tests

On command-line interface

  1. Install http://phantomjs.org/
  2. ./run-tests.sh

On browser

  1. Install http://phantomjs.org/
  2. python -m SimpleHTTPServer 9999
  3. go to http://localhost:9999/test/runner.html

Running tests on Travis-ci.org

It can be done. Are you the one to do this?