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

linc

v0.1.0

Published

execution controller

Downloads

3

Readme

linc

js execution controller for the browser or node.js

Installation

npm install linc or include linc.js on your page

API

Linc.add( name, [ options ], fn ) Adds a widget with string name, optional options object, and run function fn. Widgets can be scoped by adding period separated namespaces in the name. Returns the module.

  • validation.signup Add the validation widget to the signup namespace
  • validation.signup.signin Add the validation widget to both signup and signin namespaces

Linc.run( [ name, ] [ options ]) Executes all functions that are unscoped, and takes an optional options object to call specific namespaces, pass in a context, or execute all stored functions (options detailed below).

Linc.get( name ) Retrieves a module with name -- can be a name along with a namespace, like widgetName.scope, which will return the widgetName module in the scope namespace.

Linc.setDefaults([ options ]) set defaults such as default context or namespace that should be used when running or adding modules.

Widget Options

  • once This widget is only called once during its life.

Run Options

  • context Each widget's associated function is called with this as context. Defaults to Linc in node and window on the browser.
  • all Calls all widgets, namespaced and unscoped.
  • namespaceOnly Calls only the namespace defined
  • data Data to be sent as arguments in function calls

Examples


  // Set the default context to be a header div in the browser
  Linc.setDefaults({
    context: $('#content')
  });

  // Adds a validation widget 
  Linc.add( 'validation', function () {
    this.find( 'form.validate' ).validate();
  });

  // Adds a selection toggle widget that can only be called once.
  Linc.add( 'selectParent', { once: true }, function () {
    this.find( 'a.select-parent' ).click(function ( e ) {
      $( this ).parent().addClass( 'selected' );
      e.preventDefault();
    });
  });

  // Adds the register widget to the account namespace
  Linc.add( 'register.account', function () {
    this.find( 'form.ajaxSubmit' ).submit(function( e ) {
      $( this ).ajaxSubmit();
      e.preventDefault();
    });
  });

  // Runs all unscoped widgets -- just 'validation' and 'selectParent' in
  // this case, with default scope of the #content element
  Linc.run();

  // Runs all unscoped and widgets in the namespace 'account' --
  // both 'register' and 'validation' functions are executed, since
  // 'selectParent' is only called once, with 'document' as context
  Linc.run('.account', { context: document });

  // You can also pass data to all modules called
  Linc.add('header.updates', function ( data ) {
    $('#header h1').update( data.title );
  });
  $.ajax({
    url: 'http://localhost',
    success: function ( data ) { Linc.run('.updates', { data: data }) }
  });

Development

Uses jasmine-node for running specs, and coffeescript for source -- run make in project root to compile and run specs.