Hello gents,
I'm looking to control some sorted lists using an event-based model (pre-existing). Adding and deleting elements works wonderfully.
However, when an element is moved in the array, this (naturally) triggers a delete followed by an add event. My best guess is to use setTimeout (ick) and simply wait around some small length (20 ms) to see if an add event immediately follows.
This seems a bit sloppy and unreliable (what if there is a lot going on and the timeout is exceeded? what if a large number of moves take place, each delayed by x ms?)
Is there a simple way I could suppress the delete/add notifications and create my own from within knockout? Maybe using an extender?
I'm not looking for anyone to write the code--I'll do my homework and ask questions if I have issues.
I simply want to see if any features or patterns spring to mind that I should investigate or if this is a previously invented wheel.