@liveblocks/react
Advanced tools
Comparing version 0.8.0 to 0.8.2
@@ -1267,3 +1267,3 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
flushData: { | ||
presence: null, | ||
presence: me == null ? {} : me, | ||
messages: [], | ||
@@ -1299,4 +1299,2 @@ storageOperations: [], | ||
///////////// | ||
connect: machine.connect, | ||
disconnect: machine.disconnect, | ||
getConnectionState: machine.selectors.getConnectionState, | ||
@@ -1326,5 +1324,9 @@ getCurrentUser: machine.selectors.getCurrentUser, | ||
}; | ||
room._onNavigatorOnline = machine.onNavigatorOnline; | ||
room._onVisibilityChange = machine.onVisibilityChange; | ||
return room; | ||
return { | ||
connect: machine.connect, | ||
disconnect: machine.disconnect, | ||
onNavigatorOnline: machine.onNavigatorOnline, | ||
onVisibilityChange: machine.onVisibilityChange, | ||
room, | ||
}; | ||
} | ||
@@ -1338,2 +1340,12 @@ class LiveblocksError extends Error { | ||
/** | ||
* Create a client that will be responsible to communicate with liveblocks servers. | ||
* | ||
* ### Example | ||
* ``` | ||
* const client = createClient({ | ||
* authEndpoint: "/api/auth" | ||
* }) | ||
* ``` | ||
*/ | ||
function createClient(options) { | ||
@@ -1347,13 +1359,14 @@ if (typeof options.throttle === "number") { | ||
function getRoom(roomId) { | ||
return rooms.get(roomId) || null; | ||
const internalRoom = rooms.get(roomId); | ||
return internalRoom ? internalRoom.room : null; | ||
} | ||
function enter(roomId, initialPresence) { | ||
let room = rooms.get(roomId); | ||
if (room) { | ||
return room; | ||
let internalRoom = rooms.get(roomId); | ||
if (internalRoom) { | ||
return internalRoom.room; | ||
} | ||
room = createRoom(roomId, Object.assign(Object.assign({}, options), { initialPresence })); | ||
rooms.set(roomId, room); | ||
room.connect(); | ||
return room; | ||
internalRoom = createRoom(roomId, Object.assign(Object.assign({}, options), { initialPresence })); | ||
rooms.set(roomId, internalRoom); | ||
internalRoom.connect(); | ||
return internalRoom.room; | ||
} | ||
@@ -1371,3 +1384,3 @@ function leave(roomId) { | ||
for (const [, room] of rooms) { | ||
room._onNavigatorOnline(); | ||
room.onNavigatorOnline(); | ||
} | ||
@@ -1379,3 +1392,3 @@ }); | ||
for (const [, room] of rooms) { | ||
room._onVisibilityChange(document.visibilityState); | ||
room.onVisibilityChange(document.visibilityState); | ||
} | ||
@@ -1382,0 +1395,0 @@ }); |
{ | ||
"name": "@liveblocks/react", | ||
"version": "0.8.0", | ||
"version": "0.8.2", | ||
"description": "", | ||
@@ -9,2 +9,12 @@ "main": "./lib/index.js", | ||
], | ||
"keywords": [ | ||
"react", | ||
"liveblocks", | ||
"multiplayer", | ||
"live-cursors", | ||
"collaborative" | ||
], | ||
"bugs": { | ||
"url": "https://github.com/liveblocks/liveblocks/issues" | ||
}, | ||
"scripts": { | ||
@@ -17,3 +27,3 @@ "build": "rollup -c", | ||
"dependencies": { | ||
"@liveblocks/client": "0.8.0" | ||
"@liveblocks/client": "0.8.2" | ||
}, | ||
@@ -43,3 +53,8 @@ "peerDependencies": { | ||
"whatwg-fetch": "^3.6.2" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/liveblocks/liveblocks.git", | ||
"directory": "packages/liveblocks-react" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
183352
6
1840
1
0
28
0
+ Added@liveblocks/client@0.8.2(transitive)
- Removed@liveblocks/client@0.8.0(transitive)
Updated@liveblocks/client@0.8.2