diff --git a/README.md b/README.md index 4fbafce..9008460 100644 --- a/README.md +++ b/README.md @@ -106,6 +106,7 @@ Using a uuid is recommended, but it is also fine to use any other random string. your application's name in the `id` can help to prevent overlap (e.g. your-app-012345abcdef). - `id`: Peer's unique identifier +- `isHost`: If this peer is currently hosting or not - `connectionCount`: Number of active peer connections (without you) - `getStorage`: Retrieve storage object diff --git a/package.json b/package.json index f2dc3b9..6affec0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "playpeerjs", - "version": "1.1.0", + "version": "1.1.1", "description": "WebRTC-based wrapper for creating robust peer-2-peer multiplayer systems with ease.", "type": "module", "main": "dist/playpeer.js", diff --git a/src/index.js b/src/index.js index b4cab09..1beed50 100644 --- a/src/index.js +++ b/src/index.js @@ -583,6 +583,13 @@ export default class PlayPeer { * @returns {object} Get storage object */ get getStorage() { - return this.#storage || {}; + return { ...this.#storage } || {}; + } + + /** + * @returns {boolean} Check if this peer is hosting + */ + get isHost() { + return this.#isHost; } } \ No newline at end of file