Fix event sent by EventEmitter classes

This commit is contained in:
2014-11-05 01:17:57 +01:00
parent b1ab5822a7
commit 405d5751fb
5 changed files with 102 additions and 52 deletions

View File

@@ -1,12 +1,16 @@
var EventEmitter = require("events").EventEmitter;
var util = require("util");
var Types = require("./types.js");
//A controler owned buffer representation
function Buffer (client, buffId) {
function Buffer (client, buffId, path) {
"use strict";
EventEmitter.call(this);
var self = this;
this.path = path;
this.title = undefined;
var typeNum = 0; //WARNING : check if this should be unique to a buffer
var serNum = 0; //WARNING : check if this should be unique to a buffer
@@ -117,6 +121,7 @@ function Buffer (client, buffId) {
//Set the title of the buffer. The title is just an internal name, it's not visible by the user
this.setTitle = function (name) {
self.title = name;
client.sendCommand("setTitle", buffId, Types.string(name));
};
@@ -138,6 +143,7 @@ function Buffer (client, buffId) {
//Edit the file in the current buffer
this.editFile = function (pathName){
self.name = pathName;
client.sendCommand("editFile", buffId, Types.string(pathName));
};
@@ -177,6 +183,6 @@ function Buffer (client, buffId) {
};
}
Buffer.prototype = EventEmitter.prototype;
util.inherits(Buffer, EventEmitter);
module.exports = Buffer;