UNPKG

geofence

Version:
38 lines (34 loc) 1.08 kB
var defines = require("./defines"); //----------------------------------------------------------------------------- /** * Mocks current location * returns {string} */ async function getCurrentLocation() { let items = [ // "Hayward, CA", // "San Jose, CA", "41.43206,-81.38992", // "San Francisco, CA" ]; var item = items[Math.floor(Math.random() * items.length)]; return item; } //----------------------------------------------------------------------------- function insideGeofenceCallBack(){ console.log("WE ARE INSIDE THE FENCE!"); } //----------------------------------------------------------------------------- let options = { apiKey: "AIzaSyCrbOoQiprGssZeGi5OvdvwcYzPSUNqPN4", updateInterval: 5, getCurrentLocation: getCurrentLocation, insideGeofenceCallBack: insideGeofenceCallBack, loopForever: false }; let locationSepc = { destination: "Los Angeles, CA" }; //----------------------------------------------------------------------------- var geofence = require("./index.js")(options, locationSepc); geofence.start(options);