30秒学会 JavaScript 片段 – UUIDGeneratorBrowser
Generates a UUID in a browser. Use crypto API to generate a UUID, compliant with RFC4122 version 4.
Generates a UUID in a browser. Use crypto API to generate a UUID, compliant with RFC4122 version 4.
Returns true if the user color scheme preference is dark, false otherwise. Use window.matchMedia() w...
Makes a GET request to the passed URL. Use XMLHttpRequest web api to make a get request to the given...
Returns true if the parent element contains the child element, false otherwise. Check that parent is...
Adds an event listener to an element that will only run the callback the first time the event is tri...
Invokes the provided callback on each animation frame. Use recursion. Provided that running is true,...
Smooth-scrolls to the top of the page. Get distance from top using document.documentElement.scrollTo...
Creates a pub/sub (publish–subscribe) event hub with emit, on, and off methods. Use Object.create(nu...
Shows all the elements specified. Use the spread operator (…) and Array.prototype.forEach() to cle...
Makes a PUT request to the passed URL. Use XMLHttpRequest web api to make a put request to the given...