simple-room-client
Advanced tools
Comparing version 2.0.2 to 2.0.3
@@ -1,2 +0,5 @@ | ||
export class Collection { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Collection = void 0; | ||
class Collection { | ||
constructor(collectionClass) { | ||
@@ -33,2 +36,3 @@ this.collectionClass = collectionClass; | ||
} | ||
exports.Collection = Collection; | ||
//# sourceMappingURL=collection.js.map |
@@ -1,4 +0,8 @@ | ||
import { World } from './world'; | ||
import { room } from './store'; | ||
export { World, room }; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.room = exports.World = void 0; | ||
const world_1 = require("./world"); | ||
Object.defineProperty(exports, "World", { enumerable: true, get: function () { return world_1.World; } }); | ||
const store_1 = require("./store"); | ||
Object.defineProperty(exports, "room", { enumerable: true, get: function () { return store_1.room; } }); | ||
//# sourceMappingURL=index.js.map |
@@ -1,3 +0,7 @@ | ||
export class Room { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Room = void 0; | ||
class Room { | ||
} | ||
exports.Room = Room; | ||
//# sourceMappingURL=room.js.map |
@@ -1,3 +0,6 @@ | ||
import { atom } from 'nanostores'; | ||
export const room = atom({}); | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.room = void 0; | ||
const nanostores_1 = require("nanostores"); | ||
exports.room = (0, nanostores_1.atom)({}); | ||
//# sourceMappingURL=store.js.map |
@@ -1,3 +0,6 @@ | ||
import { WorldClass } from "./world"; | ||
export class User { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.User = void 0; | ||
const world_1 = require("./world"); | ||
class User { | ||
constructor(data, id) { | ||
@@ -8,5 +11,6 @@ this.id = id; | ||
isMe() { | ||
return WorldClass.userId == this.id; | ||
return world_1.WorldClass.userId == this.id; | ||
} | ||
} | ||
exports.User = User; | ||
//# sourceMappingURL=user.js.map |
@@ -1,11 +0,17 @@ | ||
import msgpack from 'msgpack-lite'; | ||
import merge from 'lodash.mergewith'; | ||
import { BehaviorSubject } from 'rxjs'; | ||
import { room } from './store'; | ||
import { Collection } from './collection'; | ||
import { User } from './user'; | ||
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.World = exports.WorldClass = void 0; | ||
const msgpack_lite_1 = __importDefault(require("msgpack-lite")); | ||
const lodash_mergewith_1 = __importDefault(require("lodash.mergewith")); | ||
const rxjs_1 = require("rxjs"); | ||
const store_1 = require("./store"); | ||
const collection_1 = require("./collection"); | ||
const user_1 = require("./user"); | ||
class WorldClass { | ||
constructor() { | ||
this.obs$ = new BehaviorSubject({}); | ||
this.users = new Collection(User); | ||
this.obs$ = new rxjs_1.BehaviorSubject({}); | ||
this.users = new collection_1.Collection(user_1.User); | ||
} | ||
@@ -60,3 +66,3 @@ get value() { | ||
const bufView = new Uint8Array(response); | ||
const decode = msgpack.decode(bufView); | ||
const decode = msgpack_lite_1.default.decode(bufView); | ||
const [roomId, time, data] = decode; | ||
@@ -68,3 +74,3 @@ const lastRoomId = this.obs$.value.roomId; | ||
data.join = false; | ||
mergeData = merge(Object.assign({}, (this.obs$.value.data || {})), data, (objValue, srcValue, key, object, source, stack) => { | ||
mergeData = (0, lodash_mergewith_1.default)(Object.assign({}, (this.obs$.value.data || {})), data, (objValue, srcValue, key, object, source, stack) => { | ||
if (srcValue != null && typeof srcValue == 'object') { | ||
@@ -96,3 +102,3 @@ if (Object.values(srcValue).length == 0) { | ||
}); | ||
room.set(Object.assign({}, mergeData)); | ||
store_1.room.set(Object.assign({}, mergeData)); | ||
}); | ||
@@ -102,8 +108,8 @@ return this; | ||
reset() { | ||
this.obs$ = new BehaviorSubject({}); | ||
this.obs$ = new rxjs_1.BehaviorSubject({}); | ||
} | ||
} | ||
WorldClass.userId = null; | ||
export { WorldClass }; | ||
export const World = new WorldClass(); | ||
exports.WorldClass = WorldClass; | ||
exports.World = new WorldClass(); | ||
//# sourceMappingURL=world.js.map |
{ | ||
"name": "simple-room-client", | ||
"version": "2.0.2", | ||
"version": "2.0.3", | ||
"description": "", | ||
@@ -26,3 +26,2 @@ "main": "./dist/simple-room-client.umd.cjs", | ||
], | ||
"type": "module", | ||
"keywords": [], | ||
@@ -29,0 +28,0 @@ "author": "Samuel Ronce", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
139398
3029
1
No