Curried a few common jQuery methods to allow them to be written in a point free fashion.
npm install pointfree-jquerypointfree-jquery
=================
Curried a few common jQuery methods to allow them to be written in a point free fashion.
npm install --save pointfree-jquery
``js
import { compose, map, hide, show } from 'pointfree-jquery';
import $ from 'jquery';
import IO from 'fantasy-io';
const blink = map(compose(
show('slow'),
hide('fast')
));
const program = compose(
blink,
IO
);
program(_ => $('body')).unsafePerform();
`
All methods receive their data as the last argument.
`js
import { addClass, css, on, compose, map } from 'pointfree-jquery';
import $ from 'jquery';
import IO from 'fantasy-io';
const logInfo = function(e) {
console.log(this, e);
};
const handler = compose(
on('click', logInfo),
css({ 'background': 'green' }),
addClass('example')
);
const program = compose(
map(handler),
IO
);
program(_ => $('body')).unsafePerform();
`
EFFECTS
--------
* addClasscss
* fadeIn
* fadeOut
* fadeTo
* fadeToggle
* hide
* removeclass
* show
* slideToggle
* slideUp
* toggle
*
HANDLERS
--------
* bindblur
* change
* click
* contextmenu
* dblclick
* die
* focus
* focusout
* keydown
* keypress
* keyup
* live
* load
* mousedown
* mouseenter
* mouseleave
* mousemove
* mouseup
* on
* resize
* scroll
* select
* submit
* unbind
* unload
*
UTILS
--------
* composecurry
* map
* trace`
*