How to disable back to back touches for ccui.button

I’m using ccui.button in my cocos2djs game, I actually do not want to press my button back to back. A small time gap between the touched would be nice. Is there any easy way of doing so?. Now what happens is, I could press the button back to back resulting in a crash. Any suggestions…

Not sure if I understand fully, but you can disable the button upon the first action, and then re-enable it based on your needs.

What does the crash say?

spin_btn = new ccui.Button('spinbtn-show-01.png', '', '', ccui
spin_btn.setPosition(200, 300);

//This handles click

onClick: function (sender, type) {
'use strict';

//I tried this 

 if (type === ccui.Widget.TOUCH_ENDED ||
  type === ccui.Widget.TOUCH_CANCELED) {
  this.runAction(cc.sequence(cc.scaleTo(0.05, 1),
  cc.callFunc(this.cb || function () {}, this, sender)));
 } else if (type === ccui.Widget.TOUCH_BEGAN) {
   this.runAction(cc.scaleTo(0.05, 0.9));
 sender.setTouchEnabled(true) // <-- this doesnot work

Is this there right way? Or have any other way

Check this is link, may be it will help.