<button type="button" onclick="listen('WK1234')">listen</button><br/><br/></body>
On the button click, a counter is initialized to count the callbacks. (code snippet follows). The results are:
click button the first time --> alert "responded (1): OK"
click button a second time --> alert "responded (1): OK" followed by alert "responded (2): OK"
click button again -> alert "responded (1): OK" followed by alert "responded (2): OK" followed by alert "responded (3): OK"
Code: Select all
function listen(uid)
{
responseCounter = 0;
sfs.addEventListener(SFS2X.SFSEvent.EXTENSION_RESPONSE, onListenResponse.bind(this), this);
var params = {};
params.uid = uid;
sfs.send(new SFS2X.Requests.System.ExtensionRequest("listen", params));
}
function onListenResponse(evtParams)
{
this.responseCounter++;
alert("responded (" + this.responseCounter +") : " + evtParams.params.result);
}