Code Monkey home page Code Monkey logo

geolocation's People

Contributors

dependabot[bot] avatar marsibarsi avatar vladimirpotekhin avatar waterplea avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

geolocation's Issues

[BUG] Demo page throws an error

๐Ÿž Bug report

Description

The demo page does not show the geolocation in use. I see there's an error in the console:

image

Reproduction

Go to the Demo page. Open console.

Expected behavior

Demo page should work

Versions

N/A

[BUG]

๐Ÿž Bug report

Description

Intermittently, using Chrome with geolocate enabled, calling this.geolocation$.pipe(take(1)).subscribe(position => { doesn't have anything returned from the observer

Reproduction

this.geolocation$.pipe(take(1)).subscribe(position => {
                this.latitude = position.coords.latitude;
                this.longitude = position.coords.longitude;
                console.log('a');
            }, () => {
                console.log('b');
            },
            () => {
                console.log('c');
            });

        if (!this.geolocationSupport) {
                console.log('d');
        }

None of the console logs happen

http://www.stackblitz.com/...

Expected behavior

At least attempt to obtain geoposition

Versions

  • OS: macOS 11.2.3 Big Sur
  • Browser Chrome 89.0.4389.114
  • Angular 11.2.2

Additional context

Brave - Works
Safari - Works

I have tried over HTTP and HTTPs

I have tried Incognito Chrome. I have tried clearing browser cache

[BUG] Cannot find name "Position" or "Coordinates"

๐Ÿž Bug report

Description

Cannot find name "Position"

image

Reproduction

This error just surfaced the other day. I have the common library installed also.

Expected behavior

Expect Position and Coordinates types to be supplied with library

Versions

  • OS: [e.g. iOS] any os
  • Browser [e.g. chrome, safari] any browser
  • Angular [v11]

Additional context

Unable to find where the Position and Coordinates types are or should be supplied from.

Thanks for fantastic libraries

[BUG] start:ssr script is not working

๐Ÿž Bug report

Description

I'm working on creating a PR to upgrade package to use ng v12.

It appears that the current version of the start:ssr script is not working.

I'd like to verify it'd be OK if the PR I submit also won't fix that particular issue.

Reproduction

npm install
npm run start:ssr

Unsubscribe the observer

๐Ÿš€ Feature request

Is there a way to easily unsubscribe from Observable (geolocation service)?

When moving away from a component which uses geolocation service, I would like to stop observing the position. I couldn't find direct method to do that.

When I move back to the same component, it subscribes again and I have now two observers monitoring user position. If I do it again, I would have three observers firing at the same time with updated position.

Since I couldn't find direct solution, I used pipe with takeWhile, but it looks awkward.

[FEATURE] geolocation permission

๐Ÿš€ Feature request

Is your feature request related to a problem?

Having GEOLOCATION_SUPPORT injection token does not quite answer the question of whether the developer can use the geolocation Web API. The GEOLOCATION_SUPPORT simply checks if navigator.geolocation object is available. However, the user may have received the browser popup during one of the previous visits to the website and automatically clicked "Block" (like many of us do these days whenever any popup shows up). In this case, the GEOLOCATION_SUPPORT will resolve to true, but geolocation$ observable will emit an error.

Describe the solution you'd like

To answer the question of whether the user has allowed the website access to geolocation, we can run the following code:

navigator.permissions.query({ name: 'geolocation' }).then((x) => console.log(x.state))
// this will print "prompt", "denied", or "granted"

I wonder if an injection token GEOLOCATION_PERMISSION could be introduced that would run the code above under the hood? Given the fact that this API returns a Promise, I'm not sure if it can still be an Injection token or if it'll have to be an observable service similar to the geolocation$

[Important] Something to keep in mind: the support for the API above is somewhat spotty: https://caniuse.com/permissions-api

Describe alternatives you've considered

Here people suggest using the second callback for the navigator.geolocation.watchPosition method that's called upon an error. This does not really solve the issue for me because calling this function will trigger the popup and I would like to know whether the geolocation Web API is available before the popup shows up.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.