Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function(){
- const $container = document.querySelector('#site_container');
- const example = () => {
- return new Promise(resolve => {
- setTimeout(() => {
- const $button = document.createElement('a');
- $button.href = '#';
- $button.innerText = 'EXAMPLE';
- resolve($button);
- }, 0);
- });
- };
- const handleClickButton = (evt) => {
- evt.preventDefault();
- console.log('Clicked');
- }
- const initApp = async () => {
- const $button = await example();
- $button.addEventListener('click', handleClickButton);
- $container.append($button);
- };
- initApp();
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement