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
var res = $fh.sec( parameters ); //res will contain an 'error' key if it's failed |
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.sec( parameters, function(res){ | |
//success callback function. responses are passed into res object | |
}, function(error){ | |
//failure callback function. error contains the error message | |
}); |
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
<p> Current Time : </p> | |
<div id="current_time_response"> </div> | |
<button id='current_time'> Refresh time </button> | |
<script> | |
$(document).ready(function(){ | |
$('#current_time').click(readTime); | |
}); | |
function readTime() { |
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
// Add some test placemarks so cache can be invalidated if required | |
//mashup.push({type: 'test', title: 'Test 1', lat: 57.5, lon: -7.5}); | |
//mashup.push({type: 'test', title: 'Test 2', lat: 57, lon: -7}); | |
//mashup.push({type: 'test', title: 'Test 3', lat: 57.3, lon: -7.3}); |
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
var CACHE_TIME = 10 |
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 readCache() { | |
var ret = $fh.cache({ | |
"act": "load", | |
"key": "_cache" | |
}); | |
return ret.val; | |
} |
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 doCache(hash, data) { | |
var obj = { | |
"hash": hash, | |
"data": data, | |
"cached": true | |
}; | |
$fh.cache({ | |
"act": "save", | |
"key": "_cache", | |
"val": obj, |
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 getMashup() { | |
var response = {}; | |
// Check the cloud cache to see if we have data | |
var cached = readCache(); | |
// No cahced data in cloud | |
if( ""=== cached ) { | |
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
// Call the server side function to get the mashup data | |
$fh.act({ | |
act: 'getMashup', | |
req: { | |
hash: hash, | |
timestamp: new Date().getTime() | |
} | |
}, function (res) { | |
var mashup = res; | |
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 doMashUp() { | |
var mashup = []; | |
// Add some test placemarks so cache can be invalidated if required | |
//mashup.push({type: 'test', title: 'Test 1', lat: 57.5, lon: -7.5}); | |
//mashup.push({type: 'test', title: 'Test 2', lat: 57, lon: -7}); | |
//mashup.push({type: 'test', title: 'Test 3', lat: 57.3, lon: -7.3}); | |
// Get placemarks from flickr | |
var flickr = getFlickrData(); |