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-hotpushes

v0.6.0

Published

Simple Hot pushes

Downloads

15

Readme

#cordova-plugin-hotpushes

Download and cache remotely hosted content.

This plugin is a work in progress and it is not production ready. PR welcome.

Installation

cordova plugin add cordova-plugin-hotpushes

Supported Platforms

  • Android
  • iOS
  • WP8

Examples

API

HotPush.sync(options)

Parameter | Description --------- | ------------ options.src | String URL to hot push endpoint options.versionFileName | String Name of the json file containing the version information options.type | String (Optional) Defines the hot push strategy applied to the content.The type HOTPUSH_TYPE.REPLACE is the default behaviour that completely removes existing content then copies new content from a zip file. The type HOTPUSH_TYPE.MERGE will download and replace only content which has changed. options.headers | Object (Optional) Set of headers to use when requesting the remote content from options.src. options.archiveURL | String (Mandatory if options.type === Hotpush.HOTPUSH_TYPE.REPLACE) URL of the zip containing the files to hot push. options.documentsPath | Object (Optional) Path to the Documents folder (useful for WKWebView) options.checkType | String (Optional) Set to Hotpush.HOTPUSH_CHECK_TYPE.VERSION if you want to use the version number in your version.json instead of timestamp options.debug | Boolean (Optional) Print debug information in the console

Returns

  • Instance of HotPush.

Example

var hotpushes = HotPush.sync({
  src: 'http://myserver/hot/',
  versionFileName: 'version.json',
  type: Hotpush.HOTPUSH_TYPE.REPLACE,
  archiveURL: 'http://myserver/hot/assets.zip'
});

hotpushes.loadWaitingLocalFiles()

Load the local files at position -1 (see version.json).

Parameter | Description --------- | ------------ no parameters |

hotpushes.loadAllLocalFiles()

Load the local files at position >= 0.

Parameter | Description --------- | ------------ no parameters |

hotpushes.check()

Check if there is a new version available on the server.

Parameter | Description --------- | ------------ no parameters |

hotpushes.update()

Download the files on the server.

Parameter | Description --------- | ------------ no parameters |

hotpushes.on(event, callback)

Parameter | Description --------- | ------------ event | String Name of the event to listen to. See below for all the event names. callback | Function is called when the event is triggered.

hotpushes.on('updateFound', callback)

The event updateFound will be triggered when a new update is found on the server.

Callback Parameter | Description ------------------ | ----------- no parameters |

Example

hotpushes.on('updateFound', function() {
  hotpushes.update();
});

hotpushes.on('noUpdateFound', callback)

The event noUpdateFound will be triggered when no new update is found on the server.

Callback Parameter | Description ------------------ | ----------- no parameters |

Example

hotpushes.on('noUpdateFound', function() {
  alert('All good!');
});

hotpushes.on('progress', callback)

The event progress will be triggered on each update as the native platform downloads and caches the content.

Callback Parameter | Description ------------------ | ----------- data.progress | Integer Progress percentage between 0 - 100. The progress includes all actions required to cache the remote content locally. This is different on each platform, but often includes requesting, downloading, and extracting the cached content along with any system cleanup tasks. data.status | Integer Enumeration of PROGRESS_STATE to describe the current progress state.

Example

hotpushes.on('progress', function(data) {
    // data.progress
    // data.status
});

hotpushes.on('updateComplete', callback)

The event updateComplete will be triggered when the content has been successfully cached onto the device.

Callback Parameter | Description ------------------ | ----------- no parameters |

Example

hotpushes.on('updateComplete', function() {
  location.reload();
});

hotpushes.on('error', callback)

The event error will trigger when an internal error occurs and the cache is aborted.

Callback Parameter | Description ------------------ | ----------- e | Error Standard JavaScript error object that describes the error.

Example

hotpushes.on('error', function(e) {
    // e.message
});

hotpushes.on('cancel', callback)

The event cancel will trigger when hotpushes.cancel is called.

Callback Parameter | Description ------------------ | ----------- no parameters |

Example

hotpushes.on('cancel', function() {
    // user cancelled the hot push
});

hotpushes.cancel()

Cancels the content sync operation and triggers the cancel callback.

HotPush.PROGRESS_STATE

An enumeration that describes the current progress state.

Integer | Description ------- | ----------- 0 | STOPPED 1 | DOWNLOADING 2 | EXTRACTING 3 | COMPLETE

HotPush.HOTPUSH_TYPE

An enumeration that describes the type of hotpush to perform.

String | Description ------- | ----------- merge | MERGE replace | REPLACE

HotPush.HOTPUSH_CHECK_TYPE

An enumeration that describes the field to look at in the version.json file.

String | Description ------- | ----------- version | VERSION timestamp | TIMESTAMP