Receiver.onDetach( callback )

Use this method to pass a callback to a receiver that should be called when a controller detaches from the receiver. This happens when a user that is currently controlling your app, hits the close button on the screen of her smart phone.

 

Callback arguments

none

 

Code example

In the following example a developer want to know how many people use PlugPIN to connect to her presentation app and what their names are. She has prepared the function "logToDatabase" to log text to a database table. She uses that function to log information everytime someone attaches or detaches from her app.

var userName = null;

var trackUser = PLUGPIN.createReceiver( { "name" : "Presentation App" } );

trackUser
    .onAttach( function( name )
    {
        logToDatabase( 'User ' + name + ' attached!' );
        userName = name;
    }
    .onDetach( function()
    {
        logToDatabase( 'User ' + userName + ' detached!' );
    };

 

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
info@plugpin.com

Groenhoedenveem 28
1019 BL Amsterdam
The Netherlands

News letter


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