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

react-native-code-push-saga

v1.0.1

Published

Redux saga that handles synchronizing a React Native app with the CodePush service

Downloads

1,866

Readme

Redux Saga for CodePush

This module provides a "saga" for React Native apps that already use Redux and Redux Saga for modeling asynchronous behavior, and want to integrate code sychronization with the CodePush service via a simple, declarative solution.

Getting Started

  1. If you haven't already, install and setup the React Native module for CodePush

  2. Install the CodePush Redux Saga via NPM

    npm i --save react-native-code-push-saga@latest
  3. Within your app's main saga, import the saga module

    import codePushSaga from "react-native-code-push-saga";
  4. Spawn/fork an instance of the CodePush saga

    yield spawn(codePushSaga);

And that's it! By default, your app will now synchronize with CodePush on start, resume, and any time you dispatch a SYNC action to your Redux store. If you want to customize the "sync points" (e.g. on a timer interval), delay syncing after the initial app store installation, or modify the options that are used when a sync occurs, you can pass additional parameters to the saga when spawning/forking. The following example illustrate some of the possibilities:

// Disable syncing on resume, but synchronize
// with CodePush every 5 minutes.
yield spawn(codePushSaga, {
    syncOnResume: false,
    syncOnInterval: 5 * 60
});

// Don't disrupt the user with an update after
// initially installing the app, until either 10
// minutes have passed or when the "ONBOARDING_COMPLETE"
// action is dispatched.
yield spawn(codePushSaga, {
    delayByInterval: 10 * 60,
    delayByAction: "ONBOARDING_COMPLETE"
});

// Customize the install mode of updates
// to occur when the app next resumes.
yield spawn(codePushSaga, {
    syncOptions: {
        installMode: codePush.InstallMode.ON_NEXT_RESUME
    }
});

// Synchronize with CodePush anytime
// a Redux action named "NAVIGATE_HOME" is dispatched.
yield spawn(codePushSaga, {
   syncActionName: "NAVIGATE_HOME" 
});

// Invoke a callback every time the sync status changes
// or show a status bar as the download progresses.
// You can find a list of status types at
// https://github.com/Microsoft/react-native-code-push#syncstatus.
yield spawn(codePushSaga, {
   codePushStatusDidChange: this.codePushStatusDidChange,
   codePushDownloadDidProgress: this.codePushDownloadDidProgress,
});