weebney / tachyon Goto Github PK
View Code? Open in Web Editor NEWMake your site faster than light in <1 minute; instant page loads in 738 bytes
Home Page: https://fasterthanlight.net/
License: MIT License
Make your site faster than light in <1 minute; instant page loads in 738 bytes
Home Page: https://fasterthanlight.net/
License: MIT License
the mini version declares one of the variables using var
- this is discouraged for many reasons, for example leakage of variables to global object when running in script mode (not module mode)
I swapped Tachyon for instant.page on my site and I'm seeing this in my console:
Uncaught TypeError: e.forEach is not a function
at tachyon.min.js:1:593
at Array.forEach (<anonymous>)
at MutationObserver.observe.childList (tachyon.min.js:1:580)
you can see it live here https://swingtradebot.com/stocks-tagged-as/38592-inverse-etf
Firstly, thanks a lot!
Copied the snippet to a new tag in Google Tag Manager.
<script src="https://unpkg.com/[email protected]/tachyon.min.js" integrity="sha384-4iJteL1FYnj4Ju83AJvNthpx5gZ1QaXCamXhY3lxhAjTNXUN+NXq5LQV/fXOSRme" type="module" crossorigin defer />
Seems to be the integrity parameter. Any suggestions?
Should be rather easy to support scripts as well as modules and might be relevant for users (just make sure to wrap entire code in new scope to not leak variables to global scope)
(function(){
<tachyon-code>
}())
Hi!
Thank you very much for your script, I like the way you designed your library. It's really simple to understand, and it seems to do the job well, at least from my first tests! ๐ค
I just want you to know another use case that I think might be useful: combining data-tachyon-same-origin
and data-tachyon-whitelist
. This would allow the user to preload their website links and other links that a developer has marked in the allow list. For example, to preload links from:
Rest assured that I do not want you to implement this use case if you think it's not worth it for a lot of users. ๐ I had already planned to use a slightly modified version of your script for my peculiar use case. ๐
Thanks again!
~ Benjamin
if ((node.tagName === 'A' && node.href) && (('tachyon' in node.dataset === whitelistEnabled) || (!sameOriginOnly || node.origin === window.location.origin))) {
['mouseover', 'mouseout', 'touchstart', 'touchend'].forEach((eventName) => node.addEventListener(eventName, toggleLinkTag, { passive: true }));
}
tachyon.min.js:1 [Violation] Added non-passive event listener to a scroll-blocking 'touchstart' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952
document.body.append('x')
"tachyon" in t.dataset
but will fail because dataset
is undefined for text nodes and in
throws when right-hand is undefined
Hello, I added a script to the page, but it does not work, it gives errors in the console:
Uncaught TypeError: Cannot use 'in' operator to search for 'tachyon' in undefined
at t (tachyon.min.js:1:380)
at NodeList.forEach ()
at tachyon.min.js:1:619
at Array.forEach ()
at MutationObserver.observe.childList (tachyon.min.js:1:595)
What could be the problem? Thank you
Newest tachyon script has been implemented:
Checking the Network tab in Chrome, does not show any preloading when hovering over links!
Test: https://senkels.com
Replacing
Lines 38 to 42 in a4d6c56
if (whitelistEnabled == onList) {
addListenersToElement();
}
Will reduce the minifyed size by a whopping 10 bytes* ๐
* I haven't actually tried it to make sure ๐
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.