npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

swipe-it

v0.1.21

Published

Swipe a custom element out with animation

Downloads

30

Readme

Swipe-it

Swipe a custom element out.

NPM version Dependency Status Build Status Coverage Status

Give me a feed back if you have any problem with this.

Demo

Features

  • Animation like ios messages
  • Light weight and performance optimized
  • Delegate event binding
  • Custom animation
  • Custom render function
  • Support window orientation change & resize event
  • Works with sweet-sortable
  • Optional bind to list-render
  • Temporarily disable by calling bind and unbind

Example

var tap = require('component-tap-event')
var SwipeIt = require('swipe-it')
var template = require('./template.html')
var s = new SwipeIt(template)
s.bind(document.getElementById('list'), 'li')
s.delegate('touchstart', '.remove', tap(function(e, li) {
  // remove holder and swiped element with transition
  s.clear().then(function() {
    // callback on element removed
  })
}))

Events

  • start emit with swipe element when swipe start
  • end emit with swipe element after swiped element reset back
  • clear emit with swipe element just before remove transition begin, used for change the style of swiped element for transition

API

SwipeIt(template, [opts])

  • template string or element for element swiped out
  • opts optional options
  • opts.ease a ease function or string for reset&expand animation, default out-quad
  • opts.duration duration for reset in millisecon, default 350

.bind(parentNode, selector)

Bind swipe event to parentNode with delegated selector

.bind(ListRender, selector)

Bind to listRender instance, which enables automate model reative-lite bind

.ignore(selector)

Ignore touchstart event from target that within element matches selector

.render(fn)

Set a optional render function for swiped out element , fn is passed with related swiped element(which matches the bind selector) and template string, fn should return an element

.delegate(type, selector, handler)

Delegate handler of type event with matched selector within swiped out element, handler is called with original event and related swiped element.

.reset()

Reset the swiped element to original stat with animation, return promise

.clear([duration], [ease])

Remove the swiped element and related holder with transition specified by duration (default 300) in millisecond and ease timing function, return promise.

.unbind()

Unbind all event listeners, and reset status synchronizely, could be active again be calling bind