The receiver is the central object for using PlugPIN. It is the line between your app and the controlling user. The object has five getters (values you can read, but not write) and 12 methods. Most of those methods are ways to tell the receiver what to do when the controlling user performs an action. The way this works is through so-called 'callbacks'. A callback is a function that you can pass to the receiver. The receiver stores that function internally and sits on it until a certain event takes place. The receiver then calls that function, with predefined arguments.
All methods except destroy() return the receiver object, so methods calls can be chained.
To get a deeper understanding of which method you should use for your app, try the event debug tool.
Returns the name of the receiver.
Returns the value of the notification parameter.
Returns the status of the receiver. States are
The code a user should enter on her smartphone to attach to your app. If you have set the 'showHelpText' parameter to 'none', you should communicate the connection code to the user yourself.
The screen name of the user that is attached to this receiver. Will return null when no controller is attached.
onRegister( callback )
Callback is called when the Receiver has built a connection to the service. At this point the receiver will have a connectionCode and is ready for attachment.
onAttach( callback )
Callback is called when a Controller attaches to the Receiver. At this point the receiver can return the screen name of the controller.
onDetach( callback )
Callback is called when the Receiver is detached from a previously attached Controller.
onScreenNameChange( callback )
Callback is called when the controlling user changes her screen name
onTap( callback )
Callback is called when the controlling user taps her screen. A tap is like a click on website.
onCircle( callback )
Callback is called continuously while the controlling user makes a circular gesture on her screen
onTouch( callback )
Callback is called continuously while the controlling user touches her screen
onTouchEnd( callback )
Callback is called when the controlling user user stops touching her screen
onOrientationChange( callback )
Callback is called when the controlling user changes the orientation of her device
switchToURL( callback )
Load another PlugPIN and pass the currently attached controller to that app.
Forcefully detaches the currently attached controller
Deletes the receiver.