在 class 中设置事件,利用后面提到的原型?

Setting Events in a class that utilize a later mentioned Prototype?

当我到达 console.log() 时返回 window。

如何获取考虑中的元素?

let builder = function(){
    this.box = $(`<div id="box" class="box">`);
    this.inputcontainer = $(`<div id="inputcontainer" class="inputcontainer">`).appendTo(this.box);
    this.textarea = $(`<textarea id="textarea"></textarea>`).appendTo(this.inputcontainer);
    this.textarea.on("change keyup keydown input paste", this.postmsg);
    this.chat.appendTo($('body'));
}

//someothercode

builder.prototype.postmsg = (e) => {
    console.log(this); // returns window when I need it to be referencing textarea
}

let instance = new builder();
builder.prototype.postmsg = function(e){
    console.log(this.textarea);
}