Closed b0iq closed 2 years ago
Hmmm, just an idea. Would it be more future-proof to add a property such as { prefetchBehavior: "hover" }
rather than a boolean in this case? Might mitigate the amount of config fluff in the future if more prefetch options end up being added.
@Tropix126 Great!, I was thinking about that too, but I don't want my PR looks dirty with a lot of new features such as enums...etc. So for know I think it is good enough. Or if it was so important to be implemented now, I can continue developing it; if any of the reviewers tell me his opinion 😄
Good idea, thanks! I'd prefer { prefetch: "hover" }
since it would make no sense to use both hover and intersection at the same time. The interface could look like prefetch?: 'visible' | 'hover'
.
An option seems nice.
Since then the api could support something like an options for maybe I want visible but only links of a certain kind (main links), not necessarily all links.
@codediodeio Done 🔥
I agree, having options is better
@ekwoka Cool, do you me we should achieve that by add an attribute to certain elements that is requiring prefetching such as:
<a href="/about" prefetch >About</a>
?
@b0iq Yeah, something like that.
probably more like data-prefetch
but even have it configurable.
I suggest adding prefetch on hover only which is optimize the library for large page with a lot of links.