preventing duplicates in umenu

I have a umenu that is populated by javascript. However, sometimes the output of the javascript is already in the umenu. In this case I need to prevent the duplicate from being added. How may I do this?

Then whenever there’s a change, your model will update umenu. The easy way to do that if you don’t want your model to keep track of what it has previously sent, is to clear the umenu and resend everything.