diff --git a/README.md b/README.md index 2c17e4f..68dc4f2 100644 --- a/README.md +++ b/README.md @@ -36,27 +36,28 @@ progress bar is removed once the delivery is complete: ```typescript import postman, { item } from "postman"; document.addEventListener("DOMContentLoaded", () => { - const progressBar = document.querySelector("progress"); + const bar = document.querySelector("progress"); const span = document.querySelector(".percentage"); - postman( + const delivery = postman( item.font("Kanit Regular", "url(/fonts/kanit-regular.ttf)"), item.script("/js/app.js"), item.image("/images/app.png"), item.css("/css/app.css"), item.progress((percent) => { - progressBar.value = percent; + bar.value = percent; span.innerText = `${percent}%`; }) - ).deliver() - .then((package) => { - /* Add page assets */ - package.fonts.forEach((font) => documents.fonts.add(font)); - package.scripts.forEach((script) => document.body.appendChild(script)); - package.css.forEach((css) => document.head.appendChild(css)); - /* Replace progress bar */ - progressBar.remove(); - span.remove(); - }); + ).deliver(); + + delivery.then((package) => { + /* Add page assets */ + package.fonts.forEach((font) => documents.fonts.add(font)); + package.scripts.forEach((script) => document.body.appendChild(script)); + package.css.forEach((css) => document.head.appendChild(css)); + /* Replace progress bar */ + bar.remove(); + span.remove(); + }); }); ```