你们有没有发现私信输入的时候有时卡死?是因为他的输入框有个 oninput ,输入的时候会请求后台
不过我都不知道这东西有什么用?已读回显?
后面给这个单独拎出来看了
<textarea
id="MessageTextArea"
value={this.messageContent()}
oninput={withAttr('value', this.typingPush.bind(this))}
placeholder={app.translator.trans('nodeloc-whisper.forum.chat.text_placeholder')}
rows="3"
></textarea>
看起来是给闭包的,oninput的函数被绑定到
typingPush(value) {
this.messageContent(value);
m.redraw();
if (this.typingTimeout) {
app
.request({
method: 'POST',
url: app.forum.attribute('apiUrl') + '/whisper/messages/typing',
body: {
conversationId: this.conversation.id(),
userId: this.user.id(),
},
})
.then(() => {
this.typingTimeout = false;
});
}
}
然后我就不知道这东西有什么用,而且这东西闭包,我还不能写脚本去直接删除这个监听器(删除指定监听器需要你能访问指向这个函数的内存地址),删除全部监听器就不能发消息了
后面看了看,代码中是有避免这种情况的,采用了个定时理论上5s才会执行一次
我放了个断点在完成后那段,没找出问题,感觉很反常,不过这也正常,webpack是这样子的
后面发现这个 this.typingTimeout = false;
压根没执行导致的,而且为什么没执行……
孔子不知道,孟子不知道,老子不知道
浏览器版本是 Edge 最新版本

版本 131.0.2903.86 (正式版本) (64 位)
Microsoft Edge 是最新版本。
只能等 flarum 2.0 了