0.1.3 • Published 8 years ago

@standard-library/galvo-clicker v0.1.3

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

galvo-clicker

A function that, given a class name, creates an element with a corresponding click event stream. Could be used for adding left and right arrows to a slideshow.

Installation

yarn add @standard-library/galvo-clicker

Usage

import clicker from "@standard-library/galvo-clicker";

button = clicker("button");

button.element
// => <div class="button"></div>
button.click
// => Kefir.Stream

Using galvo this event stream can be used to move forward and backward in a sequence of elements:

import galvo from "@standard-library/galvo";
import clicker from "@standard-library/galvo-clicker";

const next = clicker("paginator");
const sequence = galvo({
  advance: next.click
}, ["a", "b", "c"]);

next.element.click();
next.element.click();

sequence.current
// => a---b---c