添加和移除

和你使用 jQuery 一样,添加一个事件用 on, 移除用 off

var text = new Tiny.Text('click me');
// 设置文字可点击
text.setEventEnabled(true);
// 绑定点击/触事件
text.on('pointertap', function () {
  console.log('clicked');
});
// 移除文字上的所有 pointertap 事件
text.off('pointertap');

如果只是移除 pointertap 某个事件,可以在 off 中补上第二个回调函数:

var handler = function(){
  console.log('I will be remove');
};
text.on('pointertap', handler);
text.on('pointertap', function () {
  console.log('I will not be remove');
});
text.off('pointertap', handler);