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

cordova-plugin-swipe-smooth

v1.0.0

Published

A sample Apache Cordova application that responds to the deviceready event.

Downloads

5

Readme

Swipe Plugin for Cordova

Platform Support


  • Android

Overview

The Swipe plugin for Cordova provides a convenient way to add swipe refresh functionality to your Cordova applications. This plugin allows users to refresh the content of the application by performing a swipe gesture.

Features

  • Swipe Refresh: Users can refresh the content of the application by swiping down on the screen.
  • Customization: Developers can customize various aspects of the swipe refresh functionality such as enabling/disabling, setting background color, defining swipe distance, and specifying colors.
  • Toast Notification: Option to display toast notifications before or after refreshing the content.
  • JavaScript Action: Ability to define a custom JavaScript action to be executed upon swipe refresh.

Installation

To install the Swipe plugin into your Cordova project, use the following command:

cordova plugin add cordova-plugin-swipe-smooth

Usage

After installing the plugin, you can utilize its functionality in your JavaScript code. Below is an example of how to use the Swipe plugin:

// Initialize the Swipe plugin
cordova.plugin.swipe.smooth.initialize().then(success => {
    if (success) {
        console.log("Swipe plugin initialized successfully");
    } else {
        console.error("Failed to initialize Swipe plugin");
    }
});

// Enable swipe refresh
cordova.plugin.swipe.smooth.enableSwipe();

// Customize options
cordova.plugin.swipe.smooth.setBackgroundColor("#f0f0f0");
cordova.plugin.swipe.smooth.setTextToast("Pull down to refresh");
cordova.plugin.swipe.smooth.setJsAction("customRefreshFunction()");

API Reference

initialize

/**
 *
 * Initializes the Swipe plugin with the specified options.
 *  
 * @param {Object}  { isEnable, toastShow, toastText, jsAction, backgroundColor, colors, distance }
 * @return {String} - cordova callback
 * 
 */
cordova.plugin.swipe.smooth.initialize({
    isEnable: true, 
    toastShow: true,
    toastText: "Refreshing...",
    jsAction: "window.location.reload()",
    backgroundColor: "#ffffff",
    distance: 200,
    colors: ["#000000"]
}).then(success => {
    if (success) {
        console.log("Swipe plugin initialized successfully");
    } else {
        console.error("Failed to initialize Swipe plugin");
    }
});

enableSwipe

/**
 *
 * Enables swipe refresh functionality.
 *  
 * @param {Boolean} - default true
 * @return {String} - cordova callback
 * 
 */

cordova.plugin.swipe.smooth.enableSwipe(true)

enableToast

/**
 *
 * Enables or disables toast notifications.
 *  
 * @param {Boolean} - default true
 * @return {String} - cordova callback
 * 
 */

cordova.plugin.swipe.smooth.enableToast(true)

setTextToast

/**
 *
 * Sets the text for the toast notification.
 *  
 * @param {String} - default NULL
 * @return {String} - cordova callback
 * 
 */

cordova.plugin.swipe.smooth.setTextToast()

setJsAction

/**
 *
 * Sets the JavaScript action to be executed upon swipe refresh.
 *  
 * @param {String} - default "window.location.reload()"
 * @return {String} - cordova callback
 * 
 */

cordova.plugin.swipe.smooth.setJsAction("window.location.reload()")

setBackgroundColor

/**
 *
 * Sets the background color of the swipe refresh layout.
 *  
 * @param {String} - default "#ffffff"
 * @return {String} - cordova callback
 * 
 */

cordova.plugin.swipe.smooth.setBackgroundColor("#ffffff")

setColorsAnimation

/**
 *
 * Sets the colors for the swipe refresh animation.
 *  
 * @param {Array} - default ["#000000"]
 * @return {String} - cordova callback
 * 
 */

cordova.plugin.swipe.smooth.setColorsAnimation(["#000000"])

setDistance

/**
 *
 * Sets the distance in pixels the user must swipe to trigger a refresh.
 *  
 * @param {Int} - default 200
 * @return {String} - cordova callback
 * 
 */

cordova.plugin.swipe.smooth.setDistance(200)

Usage with AdMob-Plus Plugin

If you are using the AdMob-Plus plugin to display ads, this plugin will not conflict when displaying banners. However, you may need to put some thought into preventing banners from being displayed repeatedly or stacked when the page is refreshed. You can try testing the plugin to use it simultaneously with AdMob-Plus.

Screenshots

with admob plus banner top

with admob plus banner top offset 100

with admob plus banner bottom

with admob plus banner bottom offset 100


Feel free to customize the README according to your project's needs. This template provides a basic structure to help you get started with documenting your Swipe plugin for Cordova.