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-fng

v1.0.4

Published

Performance focused event directives, that act the same as the ng-event directives (ng-click, ng-mousedown, etc.). But instead of triggering a global root scope digest, it can trigger a partial scope digest, increasing performance and responsiveness.

Downloads

114

Readme

angular-fng (Faster aNGular)

Performance focused event directives, that act the same as the ng-event directives (ng-click, ng-mousedown, etc.). But instead of triggering a global root scope digest, it can trigger a partial scope digest, increasing performance and responsiveness.

Example: Simulated large app (Greater than 1000 watchers)

LEFT: Using ng-event. RIGHT: Using fng-event, not refreshing all the watchers in an app.

New directives defined, which can be used as a replacement or in addition to the default directives:

  • fng-click
  • fng-dblclick
  • fng-mousedown
  • fng-mouseup
  • fng-mouseover
  • fng-mouseout
  • fng-mousemove
  • fng-mouseenter
  • fng-mouseleave
  • fng-keydown
  • fng-keyup
  • fng-keypress
  • fng-submit
  • fng-focus
  • fng-blur
  • fng-copy
  • fng-cut
  • fng-paste

Why

Not sure what's it all about? Have a read of: angular-fng - Improve the performance of large angular 1.x apps, by using faster event directives

Requirements

  • Angular 1.2.0 or greater - May work on older versions.

Installation

  • bower: bower install angular-fng --save
  • npm: npm install angular-fng --save
  • Or download from github: angular-fng.zip

Include angular-fng after angular.js has been loaded.

<script src="components/angular-fng/angular-fng.js"></script>

Or can be required in via require.js or other module loaders which support CommonJS or AMD module definition, just be sure that angular is loaded first

Usage

To enable add fng to your main module:

angular.module('myApp', ['fng'])

Enable partial digesting by setting $stopDigestPropagation on your chosen scope:

$chosenScope.$stopDigestPropagation = true

Then replace all uses of the ng-event directives with fng:

<a fng-click="ctrl.click()">Click Me</a>

When clicked, the digest will occur from the $chosenScope.

How it works

The fng events are opt-in directives, which behave the same as an ng event directive. However, it differs in one important way. When triggered (e.g. fng-click) it bubbles up the scope tree and searches for a defined $stopDigestPropagation property.

When found it will call a $digest in the scope where $stopDigestPropagation is set and checks all the child scopes as shown below:

If $stopDigestPropagation property isn't found, it will fallback to the default behaviour and act the same as the ng-event directives, calling a root scope digest:

Because they work the same as the existing ng-event directives, they can be dropped in and used as a replacement. That means all ng-keydowns can be converted to fng-keydowns, and so forth.

How to chose where to digest

It is not recommended that these are used at low levels, such as in individual components. The live search component, mentioned in angular-fng - Improve the performance of large angular 1.x apps, by using faster event directives, would not implement $stopDigestPropagation property. It should be implemented at the module level, or higher. Such as a group of modules that relate to a major aspect of functionality on a page.