Receiver.onTap( callback )

Use this method to pass a function to a receiver which should be called when the controlling user taps his screen. A tap is like a click on a website, a short gesture in which a finger is placed on the smartphone's screen and immediately lifted again without moving it. 

Callback arguments

  • string side
    Indicates the part of the smartphone's screen where the gesture took place.
    Values can be "left", "right", "up" or "down"


Code examples

In the following example, a developer is using PlugPIN to control a lamp with a BeagleBone hardware board. She has written a function 'toggleLampPower' which takes care of this.

         'name'             : 'Toggle lamp' 
    .onTap( function ()


In the following example, a developer is creating a Spotify app that users can control with their smartphone. He wants a tap on the left and right side of the smartphone's screen to skip to the previous or next song.

         'name'             : 'Spotify' 
    .onTap( function ( side )
        switch ( side )
            case 'left':
            case 'right':


Live example

Connect to the app in the iFrame below to check out the tap event right now.

Open in new tab.


Contact us

Talk to us!
Tell us anything you want to and please add your contact information.

Our contact info
tel. +31 (0) 20 2170013

Groenhoedenveem 28
1019 BL Amsterdam
The Netherlands

News letter

Enter your e-mail address to stay informed on everything PlugPIN!