提交 245da7a8 编写于 作者: Huan (李卓桓)'s avatar Huan (李卓桓)

code clean: use `this` in static method to visit other static properties

上级 cff5c4b8
......@@ -206,7 +206,7 @@ export class Contact implements Sayable {
public static async find(query: ContactQueryFilter): Promise<Contact | null> {
log.verbose('Contact', 'find(%s)', JSON.stringify(query))
const contactList = await Contact.findAll(query)
const contactList = await this.findAll(query)
if (!contactList || !contactList.length) {
return null
}
......
......@@ -887,7 +887,7 @@ export class Room extends EventEmitter implements Sayable {
public static async find(query: RoomQueryFilter): Promise<Room | null> {
log.verbose('Room', 'find({ topic: %s })', query.topic)
const roomList = await Room.findAll(query)
const roomList = await this.findAll(query)
if (!roomList || roomList.length < 1) {
return null
} else if (roomList.length > 1) {
......@@ -942,10 +942,10 @@ export class Room extends EventEmitter implements Sayable {
throw new Error('Room.load() no id')
}
if (id in Room.pool) {
return Room.pool[id]
if (id in this.pool) {
return this.pool[id]
}
return Room.pool[id] = new Room(id)
return this.pool[id] = new this(id)
}
}
......
......@@ -18,7 +18,7 @@
, "noImplicitThis": false
, "traceResolution": false
, "lib": [
"es2016"
"esnext"
, "dom"
]
}
......@@ -27,7 +27,8 @@
, "dist/"
]
, "include": [
"bin/*.ts"
"*.ts"
, "bin/*.ts"
, "scripts/**/*.ts"
, "examples/**/*.ts"
, "src/**/*.ts"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册