![]() |
Global Lender
A Pebble app for finding new and interesting loans on kiva.org
|
Functions | |
function | callKivaApiAsync (url, parseFxn, maxResults) |
function | getLenderInfo () |
function | getLoansForLender () |
function | getKivaActiveFieldPartners () |
function | getPreferredLoans (prefCC, maxResults) |
Pebble | addEventListener ('appmessage', function(e){console.log("AppMessage received: "+JSON.stringify(e.payload));var dict=e.payload;if('KEY_GET_LENDER_INFO'in dict){getLenderInfo();getLoansForLender();}else if('KEY_GET_PREFERRED_LOANS'in dict){var prefCC=dict['KEY_GET_PREFERRED_LOANS'];var maxResults=10;getPreferredLoans(prefCC, maxResults);}else{console.log("Unrecognized app message: "+JSON.stringify(dict));}}) |
Listen for when an AppMessage is received. More... | |
Variables | |
var | kivaCC = {} |
var | baseKivaUrl = "http://api.kivaws.org/v1/" |
var | jsonExt = ".json" |
var | kivaAppId = 'com.magnosity.global-lender' |
var | kivaAppIdParam = "appId=" + kivaAppId |
var | lenderId = 'jdb' |
var | pageArray = [] |
Array prototype | unique |
Array extension to return the unique values of an array. More... | |
var | xhrRequest |
Pebble addEventListener | ( | 'ready' | , |
function(e){console.log("PebbleKit JS ready!");Pebble.sendAppMessage({"KEY_PEBKIT_READY":1});getKivaActiveFieldPartners();} | |||
) |
Listen for when an AppMessage is received.
Listen for when the watch opens communication and inform the watch that the PebbleKit end of the channel is ready.
function callKivaApiAsync | ( | url, | |
parseFxn, | |||
maxResults | |||
) |
Calls the Kiva API web service, parsing results by calling the function passed in as parseFxn.
[in] | url | URL of the webservice |
[in] | parseFxn | Function that returns a dictionary of key/value pairs that represent the information that must be passed back to the Pebble watch. Function should expect to receive an array of JSON objects (range = [0 .. n-1 pages]), one value for each page. |
[in] | maxResults | Predetermined limit to the number of results we need to fetch from the webservice. If maxResults is zero, then all results will be fetched. (If zero results is really desired, then don't call this function!) |
function getKivaActiveFieldPartners | ( | ) |
function getLenderInfo | ( | ) |
function getLoansForLender | ( | ) |
function getPreferredLoans | ( | prefCC, | |
maxResults | |||
) |
var baseKivaUrl = "http://api.kivaws.org/v1/" |
var jsonExt = ".json" |
var kivaAppId = 'com.magnosity.global-lender' |
var kivaAppIdParam = "appId=" + kivaAppId |
var kivaCC = {} |
var lenderId = 'jdb' |
var pageArray = [] |
Array prototype unique |
Array extension to return the unique values of an array.
var xhrRequest |