Code Monkey home page Code Monkey logo

Comments (8)

k3nsei avatar k3nsei commented on June 25, 2024

@Jonnyprof could you tell more about your environment? Because I don't see a way how isPlatformBrowser would return false in any browser? this in function which isn't an instance and isn't bound function should always return Window instance.

And can you prepare some example on stackblitz by forking this project https://stackblitz.com/edit/ng-in-viewport-example?embed=1&file=src/main.ts

from ng-in-viewport.

Jonnyprof avatar Jonnyprof commented on June 25, 2024

Sorry, I didn't notice your reply.
I don't understand your question, sorry for my english. It happens with angular dev-server (ng serve) or in a web server with production build.
I've created a fork of your stackblitz where you can see (debugging or adding a logPoint) that your function isPlatformBrowser is false. You can see it here https://stackblitz.com/edit/ng-in-viewport-example-6cpco8.
I've attached a screenshot too.
imatge

I'm logging config.hash console.log('hash:', config.hash, 'rootMargin:', config.rootMargin); and it returns always false in a webserver environment but not in stackblitz because there global is defined. global is undefined normally in a browser environment. I've attached a screenshot.
imatge

You can download the stackblitz code and run it on a webserver and hash will be always false.
I've done more tests in a fork of your repository (https://github.com/Jonnyprof/ng-in-viewport/tree/hash-false) on branch hash-false and hash is always false (console.log too).

I hope this help.

from ng-in-viewport.

k3nsei avatar k3nsei commented on June 25, 2024

I will switch to btoa as now node.js lts have that function in its global scope.

from ng-in-viewport.

k3nsei avatar k3nsei commented on June 25, 2024

@all-contributors please add @Jonnyprof for bug

from ng-in-viewport.

allcontributors avatar allcontributors commented on June 25, 2024

@k3nsei

I've put up a pull request to add @Jonnyprof! 🎉

from ng-in-viewport.

k3nsei avatar k3nsei commented on June 25, 2024

Should be fixed in v15.0.0

from ng-in-viewport.

Jonnyprof avatar Jonnyprof commented on June 25, 2024

Great, thanks! Tell me if you need some testing help.

from ng-in-viewport.

k3nsei avatar k3nsei commented on June 25, 2024

@Jonnyprof You can install it and test if it works for you. As it was complete rewrite of library, it's now have 100% coverage. But unit tests are not real world scenarios. So it would be beneficial to see if it works in real app.

from ng-in-viewport.

Related Issues (20)

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.