Example of communication between native and phonegap using an event style mechanism