This file contains hidden or 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
const debounce = (fn, wait) => { | |
let timeout = null; | |
wait = wait || 250; // Default to 250ms | |
return (...args) => { | |
const delayed = () => { | |
timeout = null; | |
fn.apply(null, args); | |
}; |
This file contains hidden or 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 order = { | |
orderId: 100314, format_city: "New York, NY, USA", | |
lat: 40.7127837, lng: -74.0059413, | |
price: 150, createTime: "2017-06-08" | |
}; | |
const db = window.openDatabase("order_test", "1.0", "order map data", 2*1024*1024) | |
db.transaction(function(tx){ | |
tx.executeSql( "create table if not exists order_data(order_id primary key, format_city, lat, lng, price, create_time)", [], null, |
This file contains hidden or 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
module.exports = leftpad; | |
function leftpad (str, len, ch) { | |
str = String(str); | |
var i = -1; | |
if (!ch && ch !== 0) ch = ' '; | |
len = len - str.length; |