This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Define what a contact is, and its fields | |
app.m.contact = Ext.regModel('Contact', { | |
fields: ['first', 'last'] | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.c.contact = function () { | |
.... | |
list: function (b, e) { | |
.... | |
} | |
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.... | |
items: [{ | |
ui_type: 'Ext.Button', | |
text: 'List Contacts', | |
..... | |
handler: 'contact.list' // Controller endpoint to callback to | |
}, ....] | |
.... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$fh.webview({ | |
url: "www.feedhenry.com", | |
title: "FeedHenry" | |
}, function (result) { | |
// no need to do anything as webview is displayed | |
}, function (err) { | |
// Problem showing webview, show error instead | |
.... | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get location using Geolocation API | |
$fh.geo({interval: 0}, function (res) { | |
// Got geolocation details in response. Pass them into map api, initialising map at that point | |
$fh.map({ | |
target: '#maps_div', | |
lat: res.lat, | |
lon: res.lon, | |
zoom: 15 | |
}, function (res) { | |
// Map is being shown, no need to do anything here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// get the format of the image and base64 data from the returned picdata | |
var resultHtml = "<img src='data:image/" + picdata.format + ";base64," + picdata.b64 + "' width='300px' height='300px' ></img>"; | |
// get the last item below the buttons, which should be a container, | |
// and update it with the image | |
var items = inst.v.mainPanel.getActiveItem().items; | |
items.get(items.length - 1).update({ | |
html: resultHtml | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get contacts from device | |
$fh.contacts({act: 'list'}, function (data) { | |
// get the contacts array from data returned | |
var contacts = data.list; | |
// create the data store, passing in the contacts list | |
var store = new Ext.data.JsonStore({ | |
model: app.m.contact, // the contact model that is registered in /client/default/script/models/contact.js | |
sorters: 'last', // sort by 'last' field | |
getGroupString: self.getGroupString, // the grouping callback for each item |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getCurrentTimeRegEx() { | |
var response = $fh.web({ | |
url: 'http://www.timeanddate.com/worldclock/city.html?n=78', | |
period: 10000, //Cache response for 10 seconds | |
method: 'GET' | |
}); | |
// Construct a regular expression to extract the date and time from the response | |
var reg = /(<strong id=ct[^>]*>)([^<]*)/; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function readTime() { | |
$fh.act({act:'getCurrentTimeRegEx'}, function(res) { | |
// Display the time in-app using jQuery | |
$('#current_time_response').html(res.date); | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getCurrentTimeRegEx() { | |
var response = $fh.web({ | |
url: 'http://www.timeanddate.com/worldclock/city.html?n=78', | |
method: 'GET' | |
}); | |
// Construct a regular expression to extract the date and time from the response | |
var reg = /(<strong id=ct[^>]*>)([^<]*)/; |