Skip to content

Instantly share code, notes, and snippets.

@aca-mobile
aca-mobile / controller.js
Created December 7, 2016 13:57 — forked from davidcyp/controller.js
Test based on the outcome of the device capabilities, eg. absence or presence of network
//
// This gist explains how to test alternate paths based on device capabilities which are not under your control,
// eg. presence of network, network quality(3G, Edge, GPRS), ...
//
//
// When this code would be executed in the titanium runtime, the only way to test both code branches is by switching
// the network on/off.
//
function isNetworkPresent(){