Merge pull request #83 from thecodingmachine/cleanup_rename_frame
Cleanup: renaming "frame" to "character"
This commit is contained in:
commit
c59d693f6e
9 changed files with 49 additions and 49 deletions
|
@ -250,7 +250,7 @@ export class IoSocketController {
|
|||
socket.roomId = message.roomId;
|
||||
socket.userId = message.userId;
|
||||
socket.name = message.name;
|
||||
socket.frame = message.frame;
|
||||
socket.character = message.character;
|
||||
}
|
||||
|
||||
refreshUserPosition() {
|
||||
|
|
|
@ -7,6 +7,6 @@ export interface ExSocketInterface extends Socket {
|
|||
webRtcRoomId: string;
|
||||
userId: string;
|
||||
name: string;
|
||||
frame: string;
|
||||
character: string;
|
||||
position: PointInterface;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ let RefreshUserPositionFunction = function(rooms : ExtRooms, Io: socketIO.Server
|
|||
roomId: socket.roomId,
|
||||
position: socket.position,
|
||||
name: socket.name,
|
||||
frame: socket.frame,
|
||||
character: socket.character,
|
||||
};
|
||||
let dataArray = <any>[];
|
||||
if (mapPositionUserByRoom.get(data.roomId)) {
|
||||
|
@ -47,4 +47,4 @@ let RefreshUserPositionFunction = function(rooms : ExtRooms, Io: socketIO.Server
|
|||
|
||||
export {
|
||||
RefreshUserPositionFunction
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ export class Message {
|
|||
userId: string;
|
||||
roomId: string;
|
||||
name: string;
|
||||
frame: string;
|
||||
character: string;
|
||||
|
||||
constructor(data: any) {
|
||||
if (!data.userId || !data.roomId) {
|
||||
|
@ -11,7 +11,7 @@ export class Message {
|
|||
this.userId = data.userId;
|
||||
this.roomId = data.roomId;
|
||||
this.name = data.name;
|
||||
this.frame = data.frame;
|
||||
this.character = data.character;
|
||||
}
|
||||
|
||||
toJson() {
|
||||
|
@ -19,7 +19,7 @@ export class Message {
|
|||
userId: this.userId,
|
||||
roomId: this.roomId,
|
||||
name: this.name,
|
||||
frame: this.frame
|
||||
character: this.character
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,18 +3,18 @@ import {Message} from "../src/Model/Websocket/Message";
|
|||
|
||||
describe("Message Model", () => {
|
||||
it("should find userId and roomId", () => {
|
||||
let message = {userId: "test1", roomId: "test2", name: "foo", frame: "user"};
|
||||
let message = {userId: "test1", roomId: "test2", name: "foo", character: "user"};
|
||||
let messageObject = new Message(message);
|
||||
expect(messageObject.userId).toBe("test1");
|
||||
expect(messageObject.roomId).toBe("test2");
|
||||
expect(messageObject.name).toBe("foo");
|
||||
expect(messageObject.frame).toBe("user");
|
||||
expect(messageObject.character).toBe("user");
|
||||
})
|
||||
|
||||
it("should expose a toJson method", () => {
|
||||
let message = {userId: "test1", roomId: "test2", name: "foo", frame: "user"};
|
||||
let message = {userId: "test1", roomId: "test2", name: "foo", character: "user"};
|
||||
let messageObject = new Message(message);
|
||||
expect(messageObject.toJson()).toEqual({userId: "test1", roomId: "test2", name: "foo", frame: "user"});
|
||||
expect(messageObject.toJson()).toEqual({userId: "test1", roomId: "test2", name: "foo", character: "user"});
|
||||
});
|
||||
|
||||
it("should find throw error when no userId", () => {
|
||||
|
@ -37,4 +37,4 @@ describe("Message Model", () => {
|
|||
let messageObject = new Message(message);
|
||||
}).toThrow(new Error("userId or roomId cannot be null"));
|
||||
});
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue