Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Phonegap for Enterprise
  • Table Of Contents Toc
Phonegap for Enterprise

Phonegap for Enterprise

By : Kerri Shotts
4.5 (6)
close
close
Phonegap for Enterprise

Phonegap for Enterprise

4.5 (6)
By: Kerri Shotts

Overview of this book

This book is intended for developers who wish to use PhoneGap to develop useful, rich, secure mobile applications for their enterprise environment. The book assumes you have working knowledge of PhoneGap, HTML5, CSS3, and JavaScript, and a reasonable understanding of networking and n-tier architectures.
Table of Contents (11 chapters)
close
close
10
Index

Responding to application-level events


Although you can have the code that responds to events in the same handler, it's often better to have this code localized to the files (simply for readability and understandability). This means that the event handlers we've discussed so far simply become dispatchers on receipt of an event; they might notify any number of methods in the app when the event occurs.

A lot of JavaScript and UI frameworks have built-in methods to support this event notification system, but here we'll be generic. Such a system needs three methods: a method to register a listener for an event, a method to remove the listener, and a method to dispatch the event to all the listeners. We can define these methods in www/js/app/main.js.

First, let's define an object to hold our events and listeners, and then define addGlobalEventListener:

var globalEventListeners = {};
APP.addGlobalEventListener = function
addGlobalEventListener( event, listener ) {
  var EVENT = event.toUpperCase...
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Phonegap for Enterprise
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon