prefetchEvents option
Opened this issue · 2 comments
It would be interesting to have an option to set the events to trigger a link preload when enablePrefetch
is set to true
.
I know that it is possible to set the enablePrefetch
to false
and then use the API preload()
method, but it would be so much easier for simple cases, like adding a touchstart
event for touch devices.
Something like:
const taxi = new Core({
// default
// prefetchEvents: 'mouseenter focus'
// on "tap" only
// prefetchEvents: 'mousedown touchstart'
// add "touchstart" for touch devices
prefetchEvents: 'mouseenter focus touchstart'
});
Thank you.
@andrepimpao I am happy to add, but copuld I ask what the usecase of touchstart
would be?
I was going to add this originally, but then figured the touchstart event would be fired at effectively the same time as the click event, so by that point the transition is already starting.
@jakewhiteley oh, I was assuming that you would only request the new page between the onLeaveCompleted
and onEnter
events. So I was suggesting having a touchstart
to prefetch the page upon touching the link (since there is no mouseenter
on touch devices), but I see now that the request is made immediately after the onLeave
event.
My usecase does not apply here then. I can't think of any other usecases, so I guess this option is not needed at all, since there is already an alternative with the preload
method for edge cases.
Thank you.