Skip to content

Commit

Permalink
Merge remote-tracking branch 'hpfast/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Fong Mok committed Sep 7, 2017
2 parents 73db4ea + 112352f commit cdc33cd
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 19 deletions.
18 changes: 9 additions & 9 deletions dist/nlmaps-geolocator.iife.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ var EmitOnOff = module.exports = function(thing){
};
});

const geoLocateDefaultOpts = {
var geoLocateDefaultOpts = {
follow: false
};

Expand All @@ -88,23 +88,23 @@ function positionErrorHandler(error) {
this.emit('error', error);
}

const GeoLocator = function (opts) {
const state = Object.assign({}, geoLocateDefaultOpts, opts);
var GeoLocator = function GeoLocator(opts) {
var state = Object.assign({}, geoLocateDefaultOpts, opts);

return {
start() {
start: function start() {
state.started = true;
navigator.geolocation.getCurrentPosition(positionHandler.bind(this), positionErrorHandler.bind(this), { maximumAge: 60000 });
return this;
},
stop() {
stop: function stop() {
state.started = false;
return this;
},
isStarted() {
isStarted: function isStarted() {
return state.started;
},
log() {
log: function log() {
console.log(state);
return this;
}
Expand All @@ -113,13 +113,13 @@ const GeoLocator = function (opts) {

function geoLocator(opts) {
if ('geolocation' in navigator) {
let geolocator = index(GeoLocator(opts));
var geolocator = index(GeoLocator(opts));
geolocator.on('position', function (position) {
this.stop();
});
return geolocator;
} else {
let error = 'geolocation is not available in your browser.';
var error = 'geolocation is not available in your browser.';
throw error;
}
}
Expand Down
8 changes: 8 additions & 0 deletions packages/nlmaps-geolocator/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"presets": [
["es2015", {"modules": false}]
],
"plugins": [
"external-helpers"
]
}
18 changes: 9 additions & 9 deletions packages/nlmaps-geolocator/build/nlmaps-geolocator.cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ var EmitOnOff = module.exports = function(thing){
};
});

const geoLocateDefaultOpts = {
var geoLocateDefaultOpts = {
follow: false
};

Expand All @@ -87,23 +87,23 @@ function positionErrorHandler(error) {
this.emit('error', error);
}

const GeoLocator = function (opts) {
const state = Object.assign({}, geoLocateDefaultOpts, opts);
var GeoLocator = function GeoLocator(opts) {
var state = Object.assign({}, geoLocateDefaultOpts, opts);

return {
start() {
start: function start() {
state.started = true;
navigator.geolocation.getCurrentPosition(positionHandler.bind(this), positionErrorHandler.bind(this), { maximumAge: 60000 });
return this;
},
stop() {
stop: function stop() {
state.started = false;
return this;
},
isStarted() {
isStarted: function isStarted() {
return state.started;
},
log() {
log: function log() {
console.log(state);
return this;
}
Expand All @@ -112,13 +112,13 @@ const GeoLocator = function (opts) {

function geoLocator(opts) {
if ('geolocation' in navigator) {
let geolocator = index(GeoLocator(opts));
var geolocator = index(GeoLocator(opts));
geolocator.on('position', function (position) {
this.stop();
});
return geolocator;
} else {
let error = 'geolocation is not available in your browser.';
var error = 'geolocation is not available in your browser.';
throw error;
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/nlmaps-geolocator/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nlmaps-geolocator",
"version": "1.0.0",
"version": "1.0.1",
"description": "",
"main": "build/nlmaps-geolocator.cjs.js",
"module": "build/nlmaps-geolocator.es.js",
Expand Down

0 comments on commit cdc33cd

Please sign in to comment.