How to implement a long-press event using Polymer1.0?

It seems that a long-term event is not part of the Polymer specification.

How do you implement this?

I was thinking about using behavior and using down and up events with some debounce tricks to control such a new event, but that means I have to create my own element to use this behavior and cannot for example use it directly for any elements I need :

 <div on-long-press="_cheese">...</div> 

which is not convenient.

Do you have other solutions?

+5
source share
2 answers

You do not need to create a custom element for this. This is what polymer behavior refers to. They provide a way for different polymer elements to propagate common behavior.

Regarding the actual javascript for implementing long-term printing, you can get ideas from this question .

+2
source

You can use the Vaadin gesture for this.

https://github.com/vaadin/vaadin-context-menu/blob/master/vaadin-long-touch.html

<paper-button on-vaadin-long-touch="function"></paper-button>

+1
source

All Articles