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

angular-bacon

v2.0.1

Published

bacon.js bindings for AngularJS

Downloads

77

Readme

angular-bacon

bacon.js bindings for AngularJS.

Make your AngularJS apps even more reactive, by using bacon.js FRP library to process your scope properties.

Usage

Simply require angular-bacon in your AngularJS module, and both $rootScope and Bacon objects are augmented automatically with the following functions:

$scope.$watchAsProperty(property)

Exposes an AngularJS scope property as a bacon.js property. If the property already has a value in the scope (i.e. is not undefined), that value becomes the property's initial value.

$scope.$watchCollectionAsProperty(property)

Exposes an AngularJS scope Array or Object property as a bacon.js property. If the property already has a value in the scope (i.e. is not undefined), that value becomes the property's initial value.

This function is equivalent to $scope.$watchAsProperty but using $watchCollection instead of $watch, so that changes in Array and Object values are properly detected.

Bacon.Observable.digest($scope, property)

Digests a bacon.js observable (stream or property) back to an AngularJS scope property. Attaches an .onValue handler to the observable, which simply $applies the property in the selected scope with the selected key.

$scope.digestObservables(observables)

Digests multiple bacon.js observables at once. Simple syntactic sugar, when multiple observables are involved. observables is a map with object keys representing $scope property names into which the observables are digested into.

$scope.$asEventStream(event)

Subscribes to scope hierarchy events as Bacon.EventStream. event is a name of the event. Created stream will contain AngularJS scope event objects, augmented with an .args property, containing a list of all additional arguments passed in the $emit call.

Examples

For examples, see here. This example somewhat mimics raimohanska's awesome bacon.js tutorials: it features a simple login validation form, where a slow backend "is-nickname-taken" check is simulated by a stream with a 5-second delay. In addition, the two selected passwords must match, and be at least five characters long before the submit button is enabled.

Changelog

2.0.1

Update dependencies.

2.0.0

Use $evalAsync instead of $apply when digesting streams to scopes. This change is potentially backwards-incompatible for code that relies on synchronous digestion of streams.

1.5.1

Fix issue with root scope digest already in progress when digesting streams in directives.

1.5.0

Augment isolate scopes with angular-bacon functions.

1.4.1

Add package.json main module.

1.4.0

Add $asEventStream(event).

1.3.2

Fix issue with end of bus not having its scope bound correctly on scope destruction callback.

1.3.1

Bump bacon.js to newer version.

1.3.0

Add $watchCollectionAsProperty(). Requires Angular 1.2+.

1.2.0

End $watchAsProperty() streams and unsubscribe .digest() listeners when scope is destroyed.

1.1.2

Add MIT License.