yairEO/tagify

Common event 'change' for handle if input value prop is changed by plugin

7iomka opened this issue · 3 comments

Hi.
I need to update my local variables when input value changed.
Currently I needed this stuff:

const inputValues = null;

tagifyInstance.on('add', onUpdateTagify);
tagifyInstance.on('remove', onUpdateTagify);
tagifyInstance.on('edit:updated', onUpdateTagify);

function onUpdateTagify(e) {
inputValues = e.detail.value;
}

Proposal:
tagifyInstance.on('change', onUpdateTagify);

Multiple plugins making some common used events along with specific events - this is best practice.
For example: onBeforeUpdate, onUpdate, onAfterUpdate. (update is common, before/after - specific)

Tagify has other modes also, like "mix" or "select" so such change event, as you proposed, might be different, according to which mode is applied.

For example, mix-mode allows writing tags along-side text, so what is considered "change" here?

Maybe 'value-change' event. I mean just to use single event that fire every time if value of input has modified(updated) from other internal / api methods/events.

v3.2.0 now allows listening to multiple events with a space between them:

tagifyInstance.on('add remove edit:updated', onUpdateTagify)