项目作者: DamonOehlman

项目描述 :
Functional User Interaction Library
高级语言: JavaScript
项目地址: git://github.com/DamonOehlman/fui.git
创建时间: 2012-03-12T14:07:37Z
项目社区:https://github.com/DamonOehlman/fui

开源协议:

下载


fui

This is an experimental library to experiment whether handling of events
can neatly be abstracted away from the actual event handling code itself.

NPM

experimental

Example Code

Here is some example code:

  1. var fui = require('fui');
  2. fui()
  3. .up(function(context, target, x, y) {
  4. this.state.down = false;
  5. })
  6. .filter('canvas')
  7. .relative()
  8. .each(function(target) {
  9. this.args.unshift(target.getContext('2d'));
  10. })
  11. .down(function(context, target, x, y) {
  12. this.state.down = true;
  13. context.beginPath();
  14. context.moveTo(x, y);
  15. })
  16. .move(function(context, target, x, y) {
  17. if (this.lastTarget && target !== this.lastTarget) {
  18. context.moveTo(x, y);
  19. }
  20. else if (this.state.down) {
  21. context.lineTo(x, y);
  22. context.stroke();
  23. }
  24. });

Reference

bind(target, evtName, callback)

EventChain(opts)

each(handler)

filter(selector)

relative()

pipe(target)

down(handler)

up(handler)

move(handler)

_next(evt)

_on(eventName, handler)

_step(stepHandler)

FuiEventSource

add(chain)

handle(eventName)

_createEvent(name, evt)