Use this method to pass a function to a receiver which should be called when a someone starts controlling your application. This happens when a user has entered the connection code of the receiver in the PlugPIN mobile app, on his smartphone.
The callback you provide will be called with the following arguments
In the following example a developer is creating a multiplayer game. He has created two receivers, for two controllers to attach to. When the second controller attaches, he wants the screen name of the controller to be displayed. He has prepared the function 'setPlayerName' to do this for him.
var player2Receiver = PLUGPIN.createReceiver( 'Shoot m up - player 2' );
player2Receiver.onAttach( function( name )
setPlayerName( 2, name );