Unverified Kaydet (Commit) 7695d90f authored tarafından Ali GOREN's avatar Ali GOREN Kaydeden (comit) GitHub

Added missing index.js file

üst a26d0ff9
const geolocation = (options) => {
return new Promise((resolve, reject) => {
if ("geolocation" in navigator) {
switch (options.type) {
case 'currentPosition':
navigator.geolocation.getCurrentPosition(success => {
resolve(success)
}, error => {
reject(error)
}, options.position)
break;
case 'watchPosition':
let positionID = navigator.geolocation.watchPosition(success => {
success['positionID'] = positionID
success['clear'] = () => {
navigator.geolocation.clearWatch(positionID)
success['positionID'] = 0
}
resolve(success)
}, error => {
reject(error)
}, options.position)
break;
}
} else {
reject('Geolocation feature is not available in this browser')
}
})
}
module.exports = geolocation
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment