UNPKG

4.94 kBMarkdownView Raw
1# Changelog
2
3This project adheres to [Semantic Versioning Scheme](http://semver.org)
4
5---
6
7## [Unreleased](https://github.com/pusher/chatkit-client-js/compare/0.7.0...HEAD)
8
9## 0.7.0 -- 2018-03-13
10
11This version represents a radical departure from 0.6.X. The interface is very
12different, and there's a good chance we'll miss some of the changes in this
13log. If something isn't working after migration, the best place to look first
14is probably the
15[documentation](https://docs.pusher.com/chatkit/reference/javascript).
16
17### Changes
18
19- Methods with `onSuccess`, `onFailure` callbacks changed to return promises
20 instead. e.g.
21
22```javascript
23chatManager
24 .connect()
25 .then(currentUser => {})
26 .catch(err => {})
27```
28
29- All methods take a single object parameter (see the
30 [documentation](https://docs.pusher.com/chatkit/reference/javascript) for
31 details on each method's arguments)
32
33- Delegates renamed to `hooks` throughout. e.g.
34
35```javascript
36currentUser.subscribeToRoom({
37 roomId,
38 hooks: {
39 onNewMessage: m => {}
40 }
41})
42```
43
44- Hooks all prefixed with `on`. e.g. `onNewMessage`, `onStartedTyping`
45
46- `cursorSet` hook renamed to `onNewCursor`
47
48- `authContext.queryParams` and `authContext.headers` both moved to the root
49 options object in the token provider. e.g.
50
51```javascript
52const tokenProvider = new TokenProvider({
53 url: 'your.auth.url',
54 queryParams: {
55 someKey: someValue,
56 ...
57 },
58 headers: {
59 SomeHeader: 'some-value',
60 ...
61 }
62})
63```
64
65- `addUser` and `removeUser` renamed to `addUserToRoom` and `removeUserFromRoom`
66
67- methods that used to accept a `Room` object now accept a `roomId`. e.g.
68
69instead of
70
71```javascript
72currentUser.subscribeToRoom(myRoom, hooks) // WRONG
73```
74
75do
76
77```javascript
78currentUser.subscribeToRoom({ roomId: myRoom.id, hooks })
79```
80
81- The behaviour of read cursors has changed: in particular cursors are now
82 accessed via `currentUser.readCursor` and set with
83 `currentUser.setReadCursor`. See the [Read Cursors section of the
84 documentation](https://docs.pusher.com/chatkit/reference/javascript#read-cursors)
85 for details.
86
87- Presence data is now accessable on any user object under `user.presence`. e.g.
88
89```javascript
90const isOnline = user.presence.state === 'online'
91```
92
93- All users that share a common room membership are accesable under
94 `currentUser.users`, and all members of a room are accessable under
95 `room.users`.
96
97## 0.6.2 -- 2018-02-05
98
99### Fixes
100
101- Catch errors in cursors get request
102
103## 0.6.1 -- 2018-01-25
104
105### Fixes
106
107- Made sure that the `messageLimit` argument in `subscribeToRoom` was being
108 validated as a number.
109- Ensured that the `position` argument in `setCursor` is a valid number.
110- Throw an error if the userId isn't provided to the ChatManager.
111
112## 0.6.0 -- 2018-01-19
113
114### Changes
115
116- Simplify typing indicator API
117 - removed `startedTypingIn` and `stoppedTypingIn` methods
118 - instead call `isTypingIn` as frequently as you like (rate limited by the SDK)
119 - `startedTyping` and `stoppedTyping` are fired exactly once each per burst
120 of typing
121
122## 0.5.1 -- 2018-01-16
123
124### Fixes
125
126- Fixed `fetchMessageFromRoom` which wasn't passing along the values provided in the `FetchRoomMessagesOptions` parameter as query params. Thanks [@apalmer0](https://github.com/apalmer0)!
127
128
129## 0.5.0 -- 2018-01-09
130
131### Changes
132
133- `ChatManager` takes a `userId` as a required option, `TokenProvider` no
134 longer does. (`ChatManager` passes the user ID to the token provider
135 internally before requesting a token.)
136
137### Additions
138
139- `RoomDelegate` has a `cursorSet` callback, fired whenever a cursor is set in
140 the given room.
141
142- `CurrentUser` has a `setCursor` method, to set a cursor in a given room.
143
144- The `CurrentUser` object now has a `cursors` property, which contains all the
145 user's own cursors, mapped by room ID. This is guaranteed to be populated
146 before room subscriptions succeed, so e.g. `currentUser.cursors[roomId]` can
147 be used upon receiving messages to determine if they have been read already.
148
149
150## 0.4.0 -- 2018-01-04
151
152### Additions
153
154- Add initial support for receiving cursors.
155
156
157## 0.3.2 -- 2017-12-19
158
159### Changes
160
161- `addMessage` has been renamed to `sendMessage` and now expects a different set of parameters:
162
163What previously would have been this:
164
165```typescript
166currentUser.addMessage(
167 "Hi there! 👋",
168 myRoom,
169 (messageId) => {
170 console.log("Success!", messageId);
171 },
172 (error) => {
173 console.log("Error", error);
174 }
175)
176```
177
178now needs to be written like this:
179
180```typescript
181currentUser.sendMessage(
182 {
183 text: "Hey there!",
184 roomId: myRoom.id,
185 },
186 (messageId) => {
187 console.log("Success!", messageId);
188 },
189 (error) => {
190 console.log("Error", error);
191 }
192)
193```
194
195### Additions
196
197- `sendMessage` supports adding an attachment to a message. See [the docs](https://docs.pusher.com/chatkit/client/javascript#messages) for more information.
198
199
200---
201
202Older releases are not covered by this changelog.