使用 ACE 编辑器,我如何取消绑定事件? [英] With the ACE Editor, how can I unbind an event?

查看:28
本文介绍了使用 ACE 编辑器,我如何取消绑定事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

https://github.com/ajaxorg/ace/wiki/Embedding---API

editor.session.on('change', callback);

是将事件绑定到更改"的方式.但是我该如何解绑呢?

is how you bind an event to "change". But how do I unbind it?

推荐答案

使用 removeListener 删除特定回调.

Use removeListener to remove a specific callback.

editor.session.removeListener('change', callback);

或更短的版本

editor.session.off('change', callback);

使用 removeAllListeners 删除所有回调.

Use removeAllListeners to remove all callbacks.

editor.session.removeAllListeners('change');

这篇关于使用 ACE 编辑器,我如何取消绑定事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆