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

hask

v1.7.0

Published

Dispatcher architecture for webapplications

Downloads

56

Readme

Build Status npm version Bower version Code Climate

Hask is a framework which implements the Flux-Architecture designed by Facebook. It is implement in ES6 to guarantee you a 100% integration into newer version of node. It is compatible with Node.js (ES5, ES6) but also with the Browser. It helps you writing asynchron applications without breaking your head and giving you a clean strucutre with Dispatchers.

Installation

You can install hask via NPM (Node Package Manager) via your systems command line interface if you'd like to use it as a Node.js dependency. Additionaly hask is avaible on bower since 2016 to enable you a stress-free install as a frontend dependency. The installations is pretty easy, just take a look below!

npm install hask --save
bower install hask --save
Platforms

If you decide to use hask within the browser, it is recommended to install it via bower and include the minified export under /dist. If you're planning to use hask with node and you're using a node environement which fully supports ES6, you can install the package via NPM and use the file /platforms/es6. If you want to use the ES5 version, just simply require('hask').

Custom Build
# Download the latest code from GitHub
git clone https://github.com/janbiasi/hask.git
cd hask

# Install Node.js dependencies
npm install

# Using Gulp to build
gulp
Supported Node.js Versions
  • 6.x
  • 5.x
  • 4.x
  • 0.1x
  • iojs
Adjusting Build Process

If you want to adjust the whole building process - you can. Please visit the NPM or the GitHub repository of the few tasks in the gulpfile to get more information about them and their usage as well as configuration - thanks!

Usage

Content

| Class | Description | |----------------|-------------------------------| | StateMachine | A Manager for Dispatcher, Store, Constants and Actions | | Dispatcher | Handle payloads and delegate to the right action | | Store | Watchable Object to get notified about changes |

Node.js

If you're using Node.js to work with hask, you can use the default required keyword to render the hask module.

import {
    Store, Dispatcher,
    StateMachine as Machine
} from 'hask/platforms/es6';

const Store = new Store();
const Dispatcher = new Dispatcher();
const Machine = new Machine();
Browser

Using hask in the browser is pretty easy, it's global accessible via the window in your webapplication.

var Dispatcher = new Hask.Dispatcher();
var Machine = new Hask.StateMachine();
var Store = new Hask.Store();
Short Example
const Hask = require('hask');

const Store = new Hask.Store();
const Machine = new Hask.StateMachine({
    ADD: 'this is the add constant',
    REMOVE: 'this  is the remove event'
});

Store.set('value', 0);

Machine.Constants.ADD = 'this content will not be set';
Machine.Constants.ADD // this is the add ...

Machine.receive(payload => {
    switch(payload.target) {
        case Machine.Constants.ADD:
            Store.update('value', Store.get('value') + 1);
            break;
        case Machine.Constants.REMOVE:
            Store.update('vaue', Store.get('value') - 1);
            break;
        /* case ... */
        default: break;
    }
});

$('.btn-up').on('click', function(ev) {
    Machine.send({
        target: Machine.Constants.ADD,
        event: ev
    });
});

/* more listeners ... */
...

View full and complex examples