This package has been deprecated

Author message:

package renamed to galvo-dom-surface

@standard-library/galvo-surface

0.1.0 • Public • Published

galvo-surface

A function that, given an element, creates streams for swiping around. Currently supports swiping left and right and generic swiping. (Pull requests welcome.)

Implemented using Kefir.js and Hammer.js.

Installation

yarn add @standard-library/galvo-surface

Usage

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

const touchpad = surface(document.querySelector(".touchpad"));

touchpad.swipe
// => Kefir.Stream
touchpad.swipe.left
// => Kefir.Stream
touchpad.swipe.right
// => 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 surface from "@standard-library/galvo-surface";

const { swipe } = surface(document.querySelector(".touchpad"));
const sequence = galvo({
  advance: swipe.right,
  recede: swipe.left
}, ["a", "b", "c"]);

// Do a few swipes right, then one left

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

Readme

Keywords

none

Package Sidebar

Install

npm i @standard-library/galvo-surface

Weekly Downloads

0

Version

0.1.0

License

MIT

Last publish

Collaborators

  • standard-library