@culturehq/client
Advanced tools
Comparing version 10.0.0 to 10.0.1
@@ -9,2 +9,8 @@ # Changelog | ||
## [10.0.1] - 2019-08-21 | ||
### Changed | ||
- Fixed up new `@rails/actioncable` usage. | ||
## [10.0.0] - 2019-08-21 | ||
@@ -1430,3 +1436,4 @@ | ||
[unreleased]: https://github.com/CultureHQ/client/compare/v10.0.0...HEAD | ||
[unreleased]: https://github.com/CultureHQ/client/compare/v10.0.1...HEAD | ||
[10.0.1]: https://github.com/CultureHQ/client/compare/v10.0.0...v10.0.1 | ||
[10.0.0]: https://github.com/CultureHQ/client/compare/v9.7.0...v10.0.0 | ||
@@ -1433,0 +1440,0 @@ [9.7.0]: https://github.com/CultureHQ/client/compare/v9.6.1...v9.7.0 |
@@ -8,3 +8,3 @@ "use strict"; | ||
var _actioncable = _interopRequireDefault(require("@rails/actioncable")); | ||
var _actioncable = require("@rails/actioncable"); | ||
@@ -41,3 +41,3 @@ var _constants = require("./constants"); | ||
if (!consumer) { | ||
consumer = _actioncable["default"].createConsumer(getEndpoint()); | ||
consumer = (0, _actioncable.createConsumer)(getEndpoint()); | ||
} | ||
@@ -55,25 +55,18 @@ | ||
* | ||
* import React, { useEffect } from "react"; | ||
* import { onNotificationReceived } from "@culturehq/client"; | ||
* | ||
* class MyComponent { | ||
* state = { lastNotification: null }; | ||
* const MyComponent = () => { | ||
* const [lastNotification, setLastNotification] = useState(null); | ||
* | ||
* componentDidMount() { | ||
* this.subscription = onNotificationReceived(notification => { | ||
* this.setState({ lastNotification: notification }); | ||
* }); | ||
* } | ||
* useEffect( | ||
* () => { | ||
* const subscription = onNotificationReceived(setLastNotification); | ||
* return () => subscription.unsubscribe(); | ||
* }, | ||
* [setLastNotification] | ||
* ); | ||
* | ||
* componentWillUnmount() { | ||
* if (this.subscription) { | ||
* this.subscription.unsubscribe(); | ||
* } | ||
* } | ||
* | ||
* render() { | ||
* const { lastNotification } = this.state; | ||
* | ||
* return <span>{lastNotification}<span>; | ||
* } | ||
* } | ||
* return <span>{lastNotification}<span>; | ||
* }; | ||
*/ | ||
@@ -80,0 +73,0 @@ |
{ | ||
"name": "@culturehq/client", | ||
"version": "10.0.0", | ||
"version": "10.0.1", | ||
"description": "A JavaScript client that wraps the CultureHQ API", | ||
@@ -5,0 +5,0 @@ "main": "dist/client.js", |
@@ -1,2 +0,2 @@ | ||
import ActionCable from "@rails/actioncable"; | ||
import { createConsumer } from "@rails/actioncable"; | ||
@@ -17,3 +17,3 @@ import { API_HOST } from "./constants"; | ||
if (!consumer) { | ||
consumer = ActionCable.createConsumer(getEndpoint()); | ||
consumer = createConsumer(getEndpoint()); | ||
} | ||
@@ -31,25 +31,18 @@ return consumer; | ||
* | ||
* import React, { useEffect } from "react"; | ||
* import { onNotificationReceived } from "@culturehq/client"; | ||
* | ||
* class MyComponent { | ||
* state = { lastNotification: null }; | ||
* const MyComponent = () => { | ||
* const [lastNotification, setLastNotification] = useState(null); | ||
* | ||
* componentDidMount() { | ||
* this.subscription = onNotificationReceived(notification => { | ||
* this.setState({ lastNotification: notification }); | ||
* }); | ||
* } | ||
* useEffect( | ||
* () => { | ||
* const subscription = onNotificationReceived(setLastNotification); | ||
* return () => subscription.unsubscribe(); | ||
* }, | ||
* [setLastNotification] | ||
* ); | ||
* | ||
* componentWillUnmount() { | ||
* if (this.subscription) { | ||
* this.subscription.unsubscribe(); | ||
* } | ||
* } | ||
* | ||
* render() { | ||
* const { lastNotification } = this.state; | ||
* | ||
* return <span>{lastNotification}<span>; | ||
* } | ||
* } | ||
* return <span>{lastNotification}<span>; | ||
* }; | ||
*/ | ||
@@ -56,0 +49,0 @@ const subscribe = channel => callback => ( |
165520
2363