Skip to content

Browser lib to manage subscribe at geolocation service and save last locations in local storage

Notifications You must be signed in to change notification settings

Jaucordi1/Geolocation-Storage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Geolocation Storage

This library exists because I needed a portable tool to manage geolocations in browser.

How to use it

I develop this library in TypeScript, it auto-build when you install it in others projects.

It adds a UMD global var named WatchPosition that is a function who take 1 optional parameter, which is PositionOptions object type from DOM library.

window.WatchPosition({/* ... */})

This function return a new instance of my PositionSubscriber class.

This class have some public properties and methods:

Getters

name type
watching boolean
savedLocation Position | null
previousLocation Position | null

Methods

method prototype
subscribe (callback: PositionSubscriberCallback) => void
unsubscribe (callback: PositionSubscriberCallback) => void
watch () => void
stopWatch () => void

The PositionSubscriberCallback type is the following :

type PositionSubscriberCallback = (position: Position, prevPosition?: Position) => void

About

Browser lib to manage subscribe at geolocation service and save last locations in local storage

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published