Revision history [back]

click to hide/show revision 1
initial version

To receive a notification in AllJoyn.js you need to add a match rule for the notification interface:

AJ.addMatch('org.alljoyn.Notification', 'notify');

Then add the onSignal function and check for the notify signal:

AJ.onSignal = function() {
    if (this.member == 'notify') {
        //here you can access the arguments[] array
        //arguments[x] will one of the many arguments in the notif signal
        //this will print them all as a JSON string
        print(JSON.stringify(arguments));
    }
}

I'm not sure what you mean by "is this a good one to experiment with". If you mean this example then yes as you can see its very simple to receive notifications. Regardless if you have little JavaScript background, AllJoyn.js is very easy to use. You should be able to pick it up very quickly.

To receive a notification in AllJoyn.js you need to add a match rule for the notification interface:

AJ.addMatch('org.alljoyn.Notification', 'notify');

Then add the onSignal function and check for the notify signal:

AJ.onSignal = function() {
    if (this.member == 'notify') {
        //here you can access the arguments[] array
        //arguments[x] will is one of the many arguments in the notif signal
        //this will print them all as a JSON string
        print(JSON.stringify(arguments));
    }
}

I'm not sure what you mean by "is this a good one to experiment with". If you mean this example then yes as you can see its very simple to receive notifications. Regardless if you have little JavaScript background, AllJoyn.js is very easy to use. You should be able to pick it up very quickly.