npm.io
1.1.7 • Published 8 years ago

hyperapp-extended

Licence
MIT
Version
1.1.7
Deps
0
Size
35 kB
Vulns
0
Weekly
0
Stars
1

Hyperapp

Hyperapp is a JavaScript library for building web applications.

What's different

hyperapp-extended is hyperapp, but with a few additions.

Actions

Actions have an additional parameter.

// hyperapp
const actions = {
  example: value => (state, actions) => { /* state changes */ },
};

// hyperapp-extended
const actions = {
  example: value => (state, actions, current) => { /* state changes */ },
}
Components

Components have an additional parameter.

// hyperapp
const Component = (attributes, children) => <div />;

// hyperapp-extended
const Component = (attributes, children, current) => <div />;
What is 'current'?

current is an object with two methods:

  • getState() - returns the current app's global state
  • getActions() - returns the current app's global actions

Keywords