callback/callback-js — Issue #5: Create a phonegap/bridge module
Author: gtanner
Created: 2011-11-30 16:09:18+00:00
State: open

Rather than relying on the PhoneGap object we should create a bridge module that native and
other modules would use to communicate:

var bridge = require('phonegap/bridge');

bridge.exec(...);
bridge.callbackSuccess();
bridge.callbackError();

In reality the current phonegap module (https://github.com/callback/callback-js/blob/master/lib/phonegap.js) is already the "bridge" and it would be cool to refactor the assigning of the exec method from the builder to the phonegap module to make it testable outside of phonegap being booted (deviceready).

I would consider this to be Stage 1 where later on the native code should be refactored to call:

require('phonegap/bridge').callbackSuccess(...);

and we wouldn't require the PhoneGap object to exist on window.