{"__v":5,"_id":"5734c42107ad96200014696e","category":{"project":"5730eb946b55e93400b32aae","version":"5730eb946b55e93400b32ab1","_id":"5734b41b9c2cf82900b243ee","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-05-12T16:49:31.689Z","from_sync":false,"order":9999,"slug":"components","title":"Components"},"parentDoc":null,"project":"5730eb946b55e93400b32aae","user":"5730eaf719c1e00e006d215f","version":{"__v":4,"_id":"5730eb946b55e93400b32ab1","project":"5730eb946b55e93400b32aae","createdAt":"2016-05-09T19:57:08.646Z","releaseDate":"2016-05-09T19:57:08.646Z","categories":["5730eb946b55e93400b32ab2","5734b41b9c2cf82900b243ee","5734c6986d9a38200073dd32","5734cea86d9a38200073dd5a"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"0.3.25","version":"0.3.25"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-05-12T17:57:53.376Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":1,"body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Example Usage\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<div class='my-location'></div>\",\n      \"language\": \"html\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"// Pull in the library\\nconst UI = require('jibe-juice');\\n\\n// Instantiate a component, pass the selector of the container to insert component into and the opts\\nconst currentLocation = new UI.CurrentLocation('.my-location', {\\n  geolocationAPI: window.navigator.geolocation\\n});\\n\\n// Subscribe to fire this function whenever the current location component is clicked\\ncurrentLocation.subscribe(function (msg) {\\n  if (msg.isLocation) {\\n    console.log('Users current location is', msg);\\n  } else {\\n    console.log(msg);\\n  }\\n});\\n\\n// Render the DOM for the CurrentLocation component\\ncurrentLocation.render();\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"params\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Default\",\n    \"h-3\": \"Description\",\n    \"0-0\": \"el\",\n    \"0-1\": \"string\",\n    \"0-2\": \"undefined\",\n    \"0-3\": \"A string of the selector for the element to put the component in\",\n    \"1-0\": \"opts\",\n    \"1-1\": \"object\",\n    \"1-2\": \"{}\",\n    \"1-3\": \"A catch all for various options. See the opts table below for options specific to this component.\"\n  },\n  \"cols\": 4,\n  \"rows\": 2\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"opts\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Default\",\n    \"h-3\": \"Description\",\n    \"1-0\": \"iconURL\",\n    \"1-1\": \"string\",\n    \"1-2\": \"By default will use our built in `location.png`\",\n    \"1-3\": \"The path to the icon image to use\",\n    \"h-4\": \"Description\",\n    \"1-4\": \"Test\",\n    \"0-0\": \"geolocationAPI\",\n    \"0-2\": \"window.navigator.geolocation\",\n    \"0-1\": \"*\",\n    \"0-3\": \"The API to use to get the current location\"\n  },\n  \"cols\": 4,\n  \"rows\": 2\n}\n[/block]","excerpt":"","slug":"currentlocation","type":"basic","title":"CurrentLocation"}
[block:api-header] { "type": "basic", "title": "Example Usage" } [/block] [block:code] { "codes": [ { "code": "<div class='my-location'></div>", "language": "html" } ] } [/block] [block:code] { "codes": [ { "code": "// Pull in the library\nconst UI = require('jibe-juice');\n\n// Instantiate a component, pass the selector of the container to insert component into and the opts\nconst currentLocation = new UI.CurrentLocation('.my-location', {\n geolocationAPI: window.navigator.geolocation\n});\n\n// Subscribe to fire this function whenever the current location component is clicked\ncurrentLocation.subscribe(function (msg) {\n if (msg.isLocation) {\n console.log('Users current location is', msg);\n } else {\n console.log(msg);\n }\n});\n\n// Render the DOM for the CurrentLocation component\ncurrentLocation.render();", "language": "javascript" } ] } [/block] [block:api-header] { "type": "basic", "title": "params" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Type", "h-2": "Default", "h-3": "Description", "0-0": "el", "0-1": "string", "0-2": "undefined", "0-3": "A string of the selector for the element to put the component in", "1-0": "opts", "1-1": "object", "1-2": "{}", "1-3": "A catch all for various options. See the opts table below for options specific to this component." }, "cols": 4, "rows": 2 } [/block] [block:api-header] { "type": "basic", "title": "opts" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Type", "h-2": "Default", "h-3": "Description", "1-0": "iconURL", "1-1": "string", "1-2": "By default will use our built in `location.png`", "1-3": "The path to the icon image to use", "h-4": "Description", "1-4": "Test", "0-0": "geolocationAPI", "0-2": "window.navigator.geolocation", "0-1": "*", "0-3": "The API to use to get the current location" }, "cols": 4, "rows": 2 } [/block]