Skip to content

Instantly share code, notes, and snippets.

View davidcyp's full-sized avatar

davidcyp davidcyp

View GitHub Profile
@davidcyp
davidcyp / controller.js
Last active March 15, 2017 18:48
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(){
@davidcyp
davidcyp / background_demo.js
Created April 7, 2016 20:49 — forked from kosso/background_demo.js
Background Service notification for Titanium
/* Kosso : March 12th 2011
This the only way I managed to do this without the app crashing on resume.
Done slightly differently to the KS example, since they unregister the service and
do not use a setInterval timer.
*/
//############ in app.js :
// test for iOS 4+
@davidcyp
davidcyp / Readme.md
Created April 7, 2016 13:35 — forked from grantges/Readme.md
Shapes With Appcelerator Titanium and Hyperloop

Custom Alloy Tags based on Appcelerator Hyperloop modules

With Alloy and Hyperloop, you can quickly and easily expose native UI as Custom Alloy tags by leveraging the namespace (ns) attribute and commonjs modules.

Alloy allows you to create your own UI element that can be included into the XML View heirarchy in one of two ways, an Alloy Widget or through the use of Custom Tags.

To create your own custom tag, you link the tag to the commonjs module with the namespace attribute (ns). Here is an example using a custom tag to render a standard Titanium View: