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

redux-openfin

v1.0.0

Published

redux middleware for openfin in typescript

Downloads

42

Readme

Redux Openfin

version license Build Status Coverage Status

Redux openfin is a wrapper allowing to call openfin js api via redux actions.

  • All in typescript
  • Provide FLUX based apis
  • Provide async based apis
  • Provide cross-windows redux-action event bus
  • Provide snap-dock features

Installation

    npm i redux-openfin 
    or 
    yarn add redux-openfin

Usage

sample configure store scripts

    import { applyMiddleware, createStore, compose } from 'redux';
    import createSagaMiddleware from 'redux-saga';
    import { createOpenfinMiddleware } from 'redux-openfin';
    
    import rootReducer, {IRootState} from '../reduxs';
    import rootSaga from '../reduxs/sagas';
    
    declare const window:any;
    
    export default (
            sharedActions:string[],
            parentState?:IRootState
    )=>{
    
        const openfinMiddleware = createOpenfinMiddleware(window.fin,{
            finUuid:process.env.REACT_APP_FIN_UUID,
            sharedActions,
            // channelRandomSuffix:process.env.NODE_ENV === 'development',
            autoDocking:process.env.REACT_APP_ENABLE_AUTO_DOCKING === 'true',
            dockingOptions:{
            }
        });
        const sagaMiddleware = createSagaMiddleware();
        const devtools = window.devToolsExtension?window.devToolsExtension():(f:any):any => (f);
    
        const middleware = compose(
            applyMiddleware(
                sagaMiddleware,
                openfinMiddleware,
            ),
            devtools
        );
    
        const store = createStore(
            rootReducer(parentState),
            middleware,
        );
    
        sagaMiddleware.run(rootSaga);
    
        return store;
    
    }

sample index.tsx

    import configureStore from './utils/configureStore';
    
    import {
        CLIENT_SET_VALUE,
        applicationStarted,
        applicationChildStarted,
    } from "./redux";

    
    declare const window:any;
    
    // actions names to be shard across windows via event bus
    const sharedActions = [
        CLIENT_SET_VALUE
    ];

    
    if(window.name === process.env.REACT_APP_FIN_UUID){
        const store = configureStore(
            sharedActions,
        );
        window.store=store;
        store.dispatch(applicationStarted());
    }else{
        const store = configureStore(
            sharedActions,
            window.opener.store.getState()
        );
        window.store=store;
        store.dispatch(applicationChildStarted());
    }
    setPlatformClass(document.body,window.navigator.platform);
    ReactDOM.render(
        <Provider store = {window.store}>
            <App/>
        </Provider>
        ,
        document.getElementById('root')
    );

Sample api usage

    
    function * someSagaGenerator(){
    
        // flux api sample
        yield put.resolve(System.actions.getMonitorInfo({}));
        monitorInfoAction = yield take(System.actions.GET_MONITOR_INFO_RES);
        
        //or 
        
        // async api sample
        monitorInfoAction = yield call(System.asyncs.getMonitorInfo,System.actions.getMonitorInfo({}));
        
    }    

Supporting apis:

The author is lazy and he won't complete this section till next release