[ENHANCEMENT] Context menu items notify listeners #915

Closed
paroxysm opened this Issue Jun 21, 2013 · 1 comment

Comments

Projects
None yet
3 participants
@paroxysm

I'm submitting code that would allow the DOM elements who are the context of a context menu to notify any listeners of this event. I use this code because it's more robust than checking for "selected" property(and also because it fits right in with angular directives)

if (found) {
                    node.drawSelected();
                    data = node.getAttribute('data-webworks-context');
                    data = JSON.parse(data);
                    this.selected = {
                            title : data.header,
                            description : data.subheader,
                            selected : node
                        };
                    //dispatch contextmenu event
                    var notifyListeners = new CustomEvent("contextmenu",{bubbles:false, cancelable:true});
                    node.dispatchEvent(notifyListeners);
@lightgeneration

This comment has been minimized.

Show comment Hide comment
@lightgeneration

lightgeneration Oct 1, 2013

how to use it ?

how to use it ?

@tneil tneil closed this Jul 17, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment