12345678910111213141516171819202122232425262728 |
- /**
- * 模型基类。
- *
- * 模型基于异步模型,提供事件抽象。
- *
- * author: Sand
- * since: 2016.11.20
- */
- "use strict";
- let EventEmitter = require('events').EventEmitter;
- let RedisModel = require('./redis.model.js');
- class BaseModel extends RedisModel{
- constructor() {
- super();
- this._eventEmitter = new EventEmitter();
- }
- get eventEmitter(){
- return this._eventEmitter;
- }
- on(event, handler){
- this._eventEmitter.on(event, handler);
- }
- }
- module.exports = BaseModel;
|