单击按钮并执行由子功能和事件侦听器组成的功能。考虑一下这个
function init() {
canvas = document.getElementById("canvas");
context = canvas.getContext('2d');
context.strokeStyle = 'purple';
context.lineWidth = 6;
context.lineCap = 'round';
canvas.addEventListener('mousedown', dragStart);
canvas.addEventListener('mousemove', drag);
canvas.addEventListener('mouseup', dragStop);
}
一旦函数退出或调用另一个函数,是否可以删除此事件侦听器?谢谢