poush / H2

Supporting light weight extensions for heavy task lifting
MIT License
16 stars 32 forks source link

Drag drop and loader #76

Closed gloriousducks closed 5 years ago

gloriousducks commented 5 years ago

New Feature: #12 (PR #22)

Added a number of things:

Image editor demo: 46687261-76b0dc00-cbc8-11e8-8b75-72c0360e1789

Go back to H2 homepage: ezgif com-video-to-gif 2

Using the loader elsewhere:

Change 'YOUR_QUERY_SELECTOR' to the element that needs to exist before removing loading spinner. If element doesn't appear in 10 seconds, waitForLoader throws an error. You can create alternative spinners, just add the css and create your element with the ID 'loading'. Once the element exists, element with ID 'loading' is removed.

Example: let loader = document.createElement("div");
loader.setAttribute("id", "loading");
loader.setAttribute("class", "loading");
loader.innerHTML = "Loading…";
document.body.appendChild(loader);
waitForLoader("YOUR_QUERY_SELECTOR")
.then(res => {
// Remove spinner once the element exists in DOM.
document.getElementById("loading").remove();
})
.catch(err => {
// 10 seconds has passed and element doesn't exists
});

Loader demo: ezgif com-video-to-gif 1

poush commented 5 years ago

This pull request introduces 1 alert when merging 5074a7685c29af9562aaad27e21226c59cdaac0e into 59594e753f5b61f895afbb4762e589a3ab7a7a2a - view on LGTM.com

new alerts:


Comment posted by LGTM.com

poush commented 5 years ago

This pull request introduces 1 alert when merging 58998a850a986c50c811bfc5dc48c6ead57180c6 into 59594e753f5b61f895afbb4762e589a3ab7a7a2a - view on LGTM.com

new alerts:


Comment posted by LGTM.com

poush commented 5 years ago

Thank you!