- Install LiveView globally:
npm i -g liveview- Change the
~/.titanium/config.jsonto include the CLI hook (underpaths->hook):
{
"user": { ... },
"app": { ... },
"cli": { ... },| var TiSpeech = require('ti.speech'); | |
| TiSpeech.initialize('en_US'); // locale is optional | |
| var win = Ti.UI.createWindow({ | |
| backgroundColor: '#fff' | |
| }); | |
| var currentValue = ''; |
| func handleData() { | |
| let jsonData: [String: Any] | |
| let text = String(describing: self.data) | |
| // JSON serialisation can fail, use do-catch (like try-catch in | |
| // to cope with possible failuresJava/C) | |
| do { | |
| // JSON data is copied into a key/value dictionary | |
| jsonData = try JSONSerialization.jsonObject(with: self.data, options: [.mutableContainers]) as! [String: Any] | |
| } catch { | |
| return debugPrint("Error occurred: \(error.localizedDescription)") |
| /** | |
| * Crops a given image URL to an optional aspect ratop (square by default). | |
| * | |
| * Example: | |
| * | |
| * const image = await ImageCroppingManager.crop(myImageURL); | |
| * | |
| */ | |
| export default class ImageCroppingManager { |
| # Either use "polling" or "websocket" for the "transport" option | |
| curl --include \ | |
| --no-buffer \ | |
| --header "Connection: Upgrade" \ | |
| --header "Upgrade: websocket" \ | |
| --header "Host: example.com:80" \ | |
| --header "Origin: http://google.com:80" \ | |
| --header "Sec-WebSocket-Key: jJSjsoSlsjSh37==" \ | |
| --header "Sec-WebSocket-Version: 13" \ |
| import RoundedShadowView from 'rounded-shadow-view'; | |
| const view = new RoundedShadowView({ backgroundColor: 'red' }).instance; | |
| // ... add to your window |
| export function showOptions (args) { | |
| const title = args.title; | |
| const message = args.message; | |
| const options = args.options; | |
| const destructive = args.destructive !== undefined ? args.destructive : -1; | |
| let cancel = -1; | |
| return new Promise((resolve, reject) => { | |
| if (OS_IOS) { | |
| options.push('Cancel'); |
| export default class Utils { | |
| static loadCachedImageFromURL(url, cb) { | |
| let filename; | |
| try { | |
| filename = url.substring(url.lastIndexOf('/') + 1); | |
| } catch (err) { | |
| cb(null); | |
| } |
npm i -g liveview~/.titanium/config.json to include the CLI hook (under paths -> hook):{
"user": { ... },
"app": { ... },
"cli": { ... },| alias tomodules="cd ~/Documents/appcelerator_modules/" | |
| alias toapps="cd ~/Documents/Apps/" | |
| alias dev="cd ~/Documents/dev/" | |
| alias totimob="cd ~/Documents/titanium_mobile/" | |
| alias toappc="appc new --import --no-services" | |
| alias iossim="ti build -p ios" | |
| alias lint="clang-format -i -style=file " | |
| alias iosdevice="appc run -p ios -T device -V \">YOUR_NAME (YOUR_TEAM_ID)\" -P \"YOUR_PROVISIONING_PROFILE\"" | |
| alias iosprod="appc run -p ios -T dist-appstore" | |
| alias androidsim="ti build -p android" |
| const dbobj = require('appcelerator.encrypteddatabase'); | |
| var win = Ti.UI.createWindow({ backgroundColor: 'white' }); | |
| var btn = Ti.UI.createButton({ title: 'Trigger' }); | |
| btn.addEventListener('click', accessDatabase); | |
| win.add(btn); | |
| win.open(); |