Skip to content

Instantly share code, notes, and snippets.

@raykendo
Created November 23, 2015 21:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raykendo/19f46ccff551c9ee35cb to your computer and use it in GitHub Desktop.
Save raykendo/19f46ccff551c9ee35cb to your computer and use it in GitHub Desktop.
Quick and simple way to add Pouch DB to ArcGIS JavaScript API
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/>
<title>Simple Map</title>
<link rel="stylesheet" href="http://js.arcgis.com/3.14/esri/css/esri.css">
<style>
html, body, #map {
height: 100%;
width: 100%;
margin: 0;
padding: 0;
}
body {
background-color: #FFF;
overflow: hidden;
font-family: "Trebuchet MS";
}
</style>
<script>
dojoConfig = {
async: true,
packages: [{
name: 'pouchdb',
location: 'https://cdn.jsdelivr.net/pouchdb/5.1.0/',
main: 'pouchdb.min'
}]
}
</script>
<script src="http://js.arcgis.com/3.14/"></script>
<script>
var map, testdb;
require(["esri/map", "pouchdb", "dojo/domReady!"], function(Map, PouchDB) {
map = new Map("map", {
basemap: "topo", //For full list of pre-defined basemaps, navigate to http://arcg.is/1JVo6Wd
center: [-122.45, 37.75], // longitude, latitude
zoom: 13
});
console.log("PouchDB:", PouchDB);
testdb = new PouchDB('places');
console.log("testdb:", testdb);
});
</script>
</head>
<body>
<div id="map"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment