You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-09-01 21:21:58 +03:00
Split out matrix.js into different files. Glue things back.
Added a models directory. Added store, http-api and client files. Slowly transitioning to the architecture outlined in SYJS-5.
This commit is contained in:
37
lib/models/event.js
Normal file
37
lib/models/event.js
Normal file
@@ -0,0 +1,37 @@
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
* Construct a Matrix Event object
|
||||
* @param {Object} event The raw event to be wrapped in this DAO
|
||||
*/
|
||||
function MatrixEvent(event) {
|
||||
this.event = event || {};
|
||||
}
|
||||
MatrixEvent.prototype = {
|
||||
getId: function() {
|
||||
return this.event.event_id;
|
||||
},
|
||||
getSender: function() {
|
||||
return this.event.user_id;
|
||||
},
|
||||
getType: function() {
|
||||
return this.event.type;
|
||||
},
|
||||
getRoomId: function() {
|
||||
return this.event.room_id;
|
||||
},
|
||||
getTs: function() {
|
||||
return this.event.ts;
|
||||
},
|
||||
getContent: function() {
|
||||
return this.event.content;
|
||||
},
|
||||
isState: function() {
|
||||
return this.event.state_key !== undefined;
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* An event from Matrix.
|
||||
*/
|
||||
module.exports.MatrixEvent = MatrixEvent;
|
Reference in New Issue
Block a user