Comments (4)
My use case for a threshold is this page. I'd like to avoid rendering 3D content that is off the screen, but it might be nice to render it when it is soon to be on screen to avoid a flicker. This could be over-optimizing though, so why don't we keep it simple to start and return a boolean. If it turns out this is not enough, it'll be an easy option to add and won't be a breaking change.
I'll go ahead and make the changes you suggested in the PR, I like that better. I'm not sure what a use case is for knowing when something is partially in the viewport though π€
from vueuse.
Quick update, I was bored so I threw together a basic implementation. Let me know if there is anything you want to tweak. One thing that might be nice to add is a "threshold", so we can treat something as on-screen once it gets within 200px or whatever.
Also if you decide you don't want this util, just go ahead and close the issue/pr π
from vueuse.
It looks great, thank you for the proposal and implementation! I have left some comments in the PR, please have a look :)
For the threshold, I am not sure what use cases this utility would be. A basic one comes in my mind would be returning an invisible | partial | visible
state. Another way with better controllability (but more complex and costly) might be returning an object with visibleArea
visbileWidth
visibleHeight
visableState
etc and let users decide how to handle those data.
What do you think?
from vueuse.
Sure, let's keep it simple first.
Awesome website btw :)
from vueuse.
Related Issues (20)
- useTextareaAutosize adds a scrollbar for elements with css styles `border` and `box-sizing: border-box` HOT 1
- `useEventSource`: Return `id` besides `event` and `data`
- useWebNotification not working on chrome mobile device HOT 2
- Whether using useAxios within a function fails to track responsive data HOT 10
- useFocus: support focus options
- feat(useAxios): params to accept Ref
- behavior of `useAnimate`'s `commitStyles` option doesn't concur with the doc
- Differentiate between `null` and `undefined` values in `useRouteQuery` HOT 2
- A transform function that returns a new object from `useRouteQuery` cause components to be re-rendered.
- useLinkTag HOT 3
- useWebNotification demo doesn't work in Arc webbrowser or in Safari (with notifications enabled)
- useInfiniteScroll Infinite loop HOT 1
- Automatically use passive: true if deep: true and clone: true in useVModel
- Can't make useResizeObserver work for multiple targets
- The project packaging will report this TypeScript error. HOT 7
- the method of makeDestructurable type is error, this is lead error when build project HOT 1
- https://www.vueusejs.com SSL certificate expired. NET::ERR_CERT_DATE_INVALID HOT 1
- useWebNotification emitting notification when mounted HOT 1
- δΈΊδ»δΉζ²‘ζ useRequest HOT 1
- useTextareaAutosize would make page scroll back when textarea height changed HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vueuse.