MCPcopy Create free account
hub / github.com/Vishal-raj-1/Awesome-JavaScript-Projects / swap

Function swap

assets/js/bubblevisualiser.js:33–50  ·  view source on GitHub ↗
(el1, el2)

Source from the content-addressed store, hash-verified

31
32// Promise to swap two blocks
33function swap(el1, el2) {
34 return new Promise((resolve) => {
35
36 // For exchanging styles of two blocks
37 var temp = el1.style.transform;
38 el1.style.transform = el2.style.transform;
39 el2.style.transform = temp;
40
41 window.requestAnimationFrame(function() {
42
43 // For waiting for .25 sec
44 setTimeout(() => {
45 container.insertBefore(el2, el1);
46 resolve();
47 }, 250);
48 });
49 });
50}
51
52// Asynchronous BubbleSort function
53async function BubbleSort(delay = 100) {

Callers 1

BubbleSortFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected