Skip to content

Commit

Permalink
📝 docs update
Browse files Browse the repository at this point in the history
  • Loading branch information
Harley Alexander committed Aug 20, 2019
1 parent 900310a commit 277b6d6
Show file tree
Hide file tree
Showing 17 changed files with 1,263 additions and 198 deletions.
22 changes: 20 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
[![NPM](https://img.shields.io/npm/v/use-pusher.svg)](https://www.npmjs.com/package/react-pusher-hooks) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)

### ⚠️ Still a WIP. Not production ready yet.

## Install

```bash
Expand All @@ -14,8 +16,6 @@ yarn add use-pusher

## Usage

### ⚠️ Still a WIP. Not production ready yet.

You must wrap your app with a `PusherProvider` and pass it config props for [pusher-js](https://github.com/pusher/pusher-js) initialisation initialisation.

```tsx
Expand Down Expand Up @@ -61,6 +61,24 @@ const Example = () => {
};
```

## `usePresenceChannel`

Like a regular channel but with member awareness.

```tsx
const Example= () => {
const {members} = usePresenceChannel('presence-awesome');

return (
<ul>
{Object.entries(members).map([id, info]) => (
<li key={id}>name: {info.name}</li>
)}
</ul>
)
}
```

## `useTrigger`

A helper function to create a **server triggered** event. BYO server (See [Trigger Server](#trigger-server) below). Pass in `triggerEndpoint` prop to `<PusherProvider />`. Any auth headers from config.auth.headers automatically get passed to the `fetch` call.
Expand Down
2 changes: 1 addition & 1 deletion docs/assets/js/search.js

Large diffs are not rendered by default.

406 changes: 406 additions & 0 deletions docs/classes/_mocks_.pusherchannelmock.html

Large diffs are not rendered by default.

227 changes: 184 additions & 43 deletions docs/classes/_mocks_.pushermock.html

Large diffs are not rendered by default.

446 changes: 446 additions & 0 deletions docs/classes/_mocks_.pusherpresencechannelmock.html

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions docs/globals.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ <h3>External modules</h3>
<li class="tsd-kind-external-module"><a href="modules/_mocks_.html" class="tsd-kind-icon">"mocks"</a></li>
<li class="tsd-kind-external-module"><a href="modules/_types_.html" class="tsd-kind-icon">"types"</a></li>
<li class="tsd-kind-external-module"><a href="modules/_usechannel_.html" class="tsd-kind-icon">"use<wbr>Channel"</a></li>
<li class="tsd-kind-external-module"><a href="modules/_usepresencechannel_.html" class="tsd-kind-icon">"use<wbr>Presence<wbr>Channel"</a></li>
<li class="tsd-kind-external-module"><a href="modules/_usepusher_.html" class="tsd-kind-icon">"use<wbr>Pusher"</a></li>
<li class="tsd-kind-external-module"><a href="modules/_usetrigger_.html" class="tsd-kind-icon">"use<wbr>Trigger"</a></li>
</ul>
Expand All @@ -100,6 +101,9 @@ <h3>External modules</h3>
<li class=" tsd-kind-external-module">
<a href="modules/_usechannel_.html">"use<wbr>Channel"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="modules/_usepresencechannel_.html">"use<wbr>Presence<wbr>Channel"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="modules/_usepusher_.html">"use<wbr>Pusher"</a>
</li>
Expand Down
6 changes: 6 additions & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ <h5><a href="https://mayteio.github.io/use-pusher/">API Reference/Docs</a></h5>
<a href="#usage" id="usage" style="color: inherit; text-decoration: none;">
<h2>Usage</h2>
</a>
<a href="#⚠️-still-a-wip-not-production-ready-yet" id="⚠️-still-a-wip-not-production-ready-yet" style="color: inherit; text-decoration: none;">
<h3>⚠️ Still a WIP. Not production ready yet.</h3>
</a>
<p>You must wrap your app with a <code>PusherProvider</code> and pass it config props for <a href="https://github.com/pusher/pusher-js">pusher-js</a> initialisation initialisation.</p>
<pre><code class="language-tsx">import React from &quot;react&quot;;
import { PusherProvider } from &quot;@city-dna/use-pusher&quot;;
Expand Down Expand Up @@ -209,6 +212,9 @@ <h2>License</h2>
<li class=" tsd-kind-external-module">
<a href="modules/_usechannel_.html">"use<wbr>Channel"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="modules/_usepresencechannel_.html">"use<wbr>Presence<wbr>Channel"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="modules/_usepusher_.html">"use<wbr>Pusher"</a>
</li>
Expand Down
9 changes: 6 additions & 3 deletions docs/interfaces/_types_.pushercontextvalues.html
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ <h3><span class="tsd-flag ts-flagOptional">Optional</span> client</h3>
<div class="tsd-signature tsd-kind-icon">client<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">undefined</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/mayteio/use-pusher/blob/daced79/src/types.ts#L5">types.ts:5</a></li>
<li>Defined in <a href="https://github.com/mayteio/use-pusher/blob/900310a/src/types.ts#L5">types.ts:5</a></li>
</ul>
</aside>
</section>
Expand All @@ -110,7 +110,7 @@ <h3><span class="tsd-flag ts-flagOptional">Optional</span> pusher<wbr>Options</h
<div class="tsd-signature tsd-kind-icon">pusher<wbr>Options<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Config</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/mayteio/use-pusher/blob/daced79/src/types.ts#L7">types.ts:7</a></li>
<li>Defined in <a href="https://github.com/mayteio/use-pusher/blob/900310a/src/types.ts#L7">types.ts:7</a></li>
</ul>
</aside>
</section>
Expand All @@ -120,7 +120,7 @@ <h3><span class="tsd-flag ts-flagOptional">Optional</span> trigger<wbr>Endpoint<
<div class="tsd-signature tsd-kind-icon">trigger<wbr>Endpoint<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/mayteio/use-pusher/blob/daced79/src/types.ts#L6">types.ts:6</a></li>
<li>Defined in <a href="https://github.com/mayteio/use-pusher/blob/900310a/src/types.ts#L6">types.ts:6</a></li>
</ul>
</aside>
</section>
Expand All @@ -144,6 +144,9 @@ <h3><span class="tsd-flag ts-flagOptional">Optional</span> trigger<wbr>Endpoint<
<li class=" tsd-kind-external-module">
<a href="../modules/_usechannel_.html">"use<wbr>Channel"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_usepresencechannel_.html">"use<wbr>Presence<wbr>Channel"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_usepusher_.html">"use<wbr>Pusher"</a>
</li>
Expand Down
33 changes: 25 additions & 8 deletions docs/interfaces/_types_.pusherproviderprops.html
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ <h3>Properties</h3>
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="_types_.pusherproviderprops.html#children" class="tsd-kind-icon">children</a></li>
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="_types_.pusherproviderprops.html#clientkey" class="tsd-kind-icon">client<wbr>Key</a></li>
<li class="tsd-kind-property tsd-parent-kind-interface tsd-is-overwrite"><a href="_types_.pusherproviderprops.html#cluster" class="tsd-kind-icon">cluster</a></li>
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="_types_.pusherproviderprops.html#defer" class="tsd-kind-icon">defer</a></li>
<li class="tsd-kind-property tsd-parent-kind-interface tsd-is-inherited"><a href="_types_.pusherproviderprops.html#disablestats" class="tsd-kind-icon">disable<wbr>Stats</a></li>
<li class="tsd-kind-property tsd-parent-kind-interface tsd-is-inherited"><a href="_types_.pusherproviderprops.html#disabledtransports" class="tsd-kind-icon">disabled<wbr>Transports</a></li>
<li class="tsd-kind-property tsd-parent-kind-interface tsd-is-inherited"><a href="_types_.pusherproviderprops.html#enabledtransports" class="tsd-kind-icon">enabled<wbr>Transports</a></li>
Expand Down Expand Up @@ -140,11 +141,11 @@ <h3><span class="tsd-flag ts-flagOptional">Optional</span> activity<wbr>Timeout<
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface tsd-is-overwrite">
<a name="auth" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagOptional">Optional</span> auth</h3>
<div class="tsd-signature tsd-kind-icon">auth<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span></div>
<div class="tsd-signature tsd-kind-icon">auth<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">AuthConfig</span></div>
<aside class="tsd-sources">
<p>Overrides Config.auth</p>
<ul>
<li>Defined in <a href="https://github.com/mayteio/use-pusher/blob/daced79/src/types.ts#L14">types.ts:14</a></li>
<li>Defined in <a href="https://github.com/mayteio/use-pusher/blob/900310a/src/types.ts#L14">types.ts:14</a></li>
</ul>
</aside>
</section>
Expand All @@ -155,7 +156,7 @@ <h3><span class="tsd-flag ts-flagOptional">Optional</span> auth<wbr>Endpoint</h3
<aside class="tsd-sources">
<p>Overrides Config.authEndpoint</p>
<ul>
<li>Defined in <a href="https://github.com/mayteio/use-pusher/blob/daced79/src/types.ts#L13">types.ts:13</a></li>
<li>Defined in <a href="https://github.com/mayteio/use-pusher/blob/900310a/src/types.ts#L13">types.ts:13</a></li>
</ul>
</aside>
</section>
Expand Down Expand Up @@ -195,10 +196,10 @@ <h3><span class="tsd-flag ts-flagOptional">Optional</span> authorizer</h3>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
<a name="children" class="tsd-anchor"></a>
<h3>children</h3>
<div class="tsd-signature tsd-kind-icon">children<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">ReactNode</span></div>
<div class="tsd-signature tsd-kind-icon">children<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">React.ReactNode</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/mayteio/use-pusher/blob/daced79/src/types.ts#L16">types.ts:16</a></li>
<li>Defined in <a href="https://github.com/mayteio/use-pusher/blob/900310a/src/types.ts#L17">types.ts:17</a></li>
</ul>
</aside>
</section>
Expand All @@ -208,7 +209,7 @@ <h3>client<wbr>Key</h3>
<div class="tsd-signature tsd-kind-icon">client<wbr>Key<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/mayteio/use-pusher/blob/daced79/src/types.ts#L11">types.ts:11</a></li>
<li>Defined in <a href="https://github.com/mayteio/use-pusher/blob/900310a/src/types.ts#L11">types.ts:11</a></li>
</ul>
</aside>
</section>
Expand All @@ -219,7 +220,17 @@ <h3>cluster</h3>
<aside class="tsd-sources">
<p>Overrides Config.cluster</p>
<ul>
<li>Defined in <a href="https://github.com/mayteio/use-pusher/blob/daced79/src/types.ts#L12">types.ts:12</a></li>
<li>Defined in <a href="https://github.com/mayteio/use-pusher/blob/900310a/src/types.ts#L12">types.ts:12</a></li>
</ul>
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
<a name="defer" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagOptional">Optional</span> defer</h3>
<div class="tsd-signature tsd-kind-icon">defer<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">false</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">true</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/mayteio/use-pusher/blob/900310a/src/types.ts#L16">types.ts:16</a></li>
</ul>
</aside>
</section>
Expand Down Expand Up @@ -386,7 +397,7 @@ <h3><span class="tsd-flag ts-flagOptional">Optional</span> trigger<wbr>Endpoint<
<div class="tsd-signature tsd-kind-icon">trigger<wbr>Endpoint<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/mayteio/use-pusher/blob/daced79/src/types.ts#L15">types.ts:15</a></li>
<li>Defined in <a href="https://github.com/mayteio/use-pusher/blob/900310a/src/types.ts#L15">types.ts:15</a></li>
</ul>
</aside>
</section>
Expand Down Expand Up @@ -454,6 +465,9 @@ <h3><span class="tsd-flag ts-flagOptional">Optional</span> wss<wbr>Port</h3>
<li class=" tsd-kind-external-module">
<a href="../modules/_usechannel_.html">"use<wbr>Channel"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_usepresencechannel_.html">"use<wbr>Presence<wbr>Channel"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_usepusher_.html">"use<wbr>Pusher"</a>
</li>
Expand Down Expand Up @@ -496,6 +510,9 @@ <h3><span class="tsd-flag ts-flagOptional">Optional</span> wss<wbr>Port</h3>
<li class=" tsd-kind-property tsd-parent-kind-interface tsd-is-overwrite">
<a href="_types_.pusherproviderprops.html#cluster" class="tsd-kind-icon">cluster</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-interface">
<a href="_types_.pusherproviderprops.html#defer" class="tsd-kind-icon">defer</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-interface tsd-is-inherited">
<a href="_types_.pusherproviderprops.html#disablestats" class="tsd-kind-icon">disable<wbr>Stats</a>
</li>
Expand Down
5 changes: 4 additions & 1 deletion docs/interfaces/_types_.usechanneloptions.html
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ <h3><span class="tsd-flag ts-flagOptional">Optional</span> skip</h3>
<div class="tsd-signature tsd-kind-icon">skip<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">false</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">true</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/mayteio/use-pusher/blob/daced79/src/types.ts#L20">types.ts:20</a></li>
<li>Defined in <a href="https://github.com/mayteio/use-pusher/blob/900310a/src/types.ts#L21">types.ts:21</a></li>
</ul>
</aside>
</section>
Expand All @@ -122,6 +122,9 @@ <h3><span class="tsd-flag ts-flagOptional">Optional</span> skip</h3>
<li class=" tsd-kind-external-module">
<a href="../modules/_usechannel_.html">"use<wbr>Channel"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_usepresencechannel_.html">"use<wbr>Presence<wbr>Channel"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_usepusher_.html">"use<wbr>Pusher"</a>
</li>
Expand Down
19 changes: 13 additions & 6 deletions docs/modules/_mocks_.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,12 @@ <h1>External module &quot;mocks&quot;</h1>
<h2>Index</h2>
<section class="tsd-panel tsd-index-panel">
<div class="tsd-index-content">
<section class="tsd-index-section ">
<section class="tsd-index-section tsd-is-not-exported">
<h3>Classes</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-class tsd-parent-kind-external-module"><a href="../classes/_mocks_.channelmock.html" class="tsd-kind-icon">Channel<wbr>Mock</a></li>
<li class="tsd-kind-class tsd-parent-kind-external-module"><a href="../classes/_mocks_.pushermock.html" class="tsd-kind-icon">Pusher<wbr>Mock</a></li>
<li class="tsd-kind-class tsd-parent-kind-external-module tsd-is-not-exported"><a href="../classes/_mocks_.pusherchannelmock.html" class="tsd-kind-icon">Pusher<wbr>Channel<wbr>Mock</a></li>
<li class="tsd-kind-class tsd-parent-kind-external-module tsd-is-not-exported"><a href="../classes/_mocks_.pushermock.html" class="tsd-kind-icon">Pusher<wbr>Mock</a></li>
<li class="tsd-kind-class tsd-parent-kind-external-module tsd-has-type-parameter tsd-is-not-exported"><a href="../classes/_mocks_.pusherpresencechannelmock.html" class="tsd-kind-icon">Pusher<wbr>Presence<wbr>Channel<wbr>Mock</a></li>
</ul>
</section>
</div>
Expand All @@ -99,6 +100,9 @@ <h3>Classes</h3>
<li class=" tsd-kind-external-module">
<a href="_usechannel_.html">"use<wbr>Channel"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="_usepresencechannel_.html">"use<wbr>Presence<wbr>Channel"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="_usepusher_.html">"use<wbr>Pusher"</a>
</li>
Expand All @@ -109,12 +113,15 @@ <h3>Classes</h3>
</nav>
<nav class="tsd-navigation secondary menu-sticky">
<ul class="before-current">
<li class=" tsd-kind-class tsd-parent-kind-external-module">
<a href="../classes/_mocks_.channelmock.html" class="tsd-kind-icon">Channel<wbr>Mock</a>
<li class=" tsd-kind-class tsd-parent-kind-external-module tsd-is-not-exported">
<a href="../classes/_mocks_.pusherchannelmock.html" class="tsd-kind-icon">Pusher<wbr>Channel<wbr>Mock</a>
</li>
<li class=" tsd-kind-class tsd-parent-kind-external-module">
<li class=" tsd-kind-class tsd-parent-kind-external-module tsd-is-not-exported">
<a href="../classes/_mocks_.pushermock.html" class="tsd-kind-icon">Pusher<wbr>Mock</a>
</li>
<li class=" tsd-kind-class tsd-parent-kind-external-module tsd-has-type-parameter tsd-is-not-exported">
<a href="../classes/_mocks_.pusherpresencechannelmock.html" class="tsd-kind-icon">Pusher<wbr>Presence<wbr>Channel<wbr>Mock</a>
</li>
</ul>
</nav>
</div>
Expand Down
Loading

0 comments on commit 277b6d6

Please sign in to comment.