@bitrefill/react-pusher
    TypeScript icon, indicating that this package has built-in type declarations

    2.4.0 • Public • Published

    react-pusher

    // Use the pusher component
     
    import Pusher from '@bitrefill/react-pusher';
     
    function SomeComponent() {
      return (
        <Pusher
          apiKey={PUSHER_API_KEY}
          opts={{additional: 'options'}}
          channel="channel"
          events={["event"]}
          onUpdate={(event, payload) => {
            // ...
          }}
        />
      )
    }
    // Load the component async
     
    import React from 'react';
    import Loadable from 'react-loadable';
     
    const LoadablePusher = Loadable({
      loader: () => import('@bitrefill/react-pusher'),
      loading: null,
    });
     
    function SomeComponent() {
      return (
        <LoadablePusher
          apiKey={PUSHER_API_KEY}
          opts={{ additional: 'options' }}
          channel="channel"
          events={["event"]}
          onUpdate={(event, payload) => {
            // ...
          }}
        />
      )
    }
    // Access the pusher instance
     
    import { getPusherClient } from '@bitrefill/react-pusher';
     
    const pusher = getPusherClient(PUSHER_API_KEY, { additional: 'options' });
    const channel = pusher.subscribe('someChannel');
    // ...
    // Access the pusher instance async
     
    import('@bitrefill/react-pusher').then(({ getPusherClient }) => {
      const pusher = getPusherClient(PUSHER_API_KEY, { additional: 'options' });
      const channel = pusher.subscribe('someChannel');
      // ...
    })
    // ...

    PropTypes

    Name Type
    apiKey PropTypes.string.isRequired
    opts PropTypes.object
    channel PropTypes.string.isRequired
    events PropTypes.array.isRequired
    onUpdate PropTypes.func.isRequired

    Keywords

    none

    Install

    npm i @bitrefill/react-pusher

    DownloadsWeekly Downloads

    52

    Version

    2.4.0

    License

    none

    Unpacked Size

    550 kB

    Total Files

    9

    Last publish

    Collaborators

    • furzel
    • wille
    • juscamarena