From 0a3ac8e641dcbb0c1913338473f9f59ca1b02db2 Mon Sep 17 00:00:00 2001 From: Cedric Date: Fri, 4 Apr 2014 16:45:59 +0200 Subject: [PATCH] Make event "pushing" cancelable. --- tagmanager.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tagmanager.js b/tagmanager.js index e280f4b..b2a01fb 100644 --- a/tagmanager.js +++ b/tagmanager.js @@ -119,7 +119,15 @@ tagId = ++max; } - if (!ignoreEvents) { $self.trigger('tm:pushing', [tag, tagId]); } + if (!ignoreEvents) { + var control={cancel:false,tag:tag,tagId: tagId}; + $self.trigger('tm:pushing', [control, tag, tagId]); + if (control.cancel) { + console.log("Pushing canceled"); + $self.val(""); + return; + } + } tlis.push(tag); tlid.push(tagId);