class Some {
constructor() {
this.data = null;
Promise.all([this.init()]).then(() => {
this.start();
});
}
start() {
console.log('START', this.data);
}
async init() {
const response = await fetch('https://jsonplaceholder.typicode.com/todos');
this.data = await response.json();
}
}
new Some();
loginig
у Вас ничего не принимает от сервера, как Вы хотите узнать о завершении операции? const loadScript = (url, callback) => {
const script = document.createElement('script');
script.addEventListener('load', () => {
callback();
});
script.src = url;
document.body.append(script);
};
loadScript('SOME_URL', () => {
console.log('Скрипт загружен');
});
const loadScript = url => new Promise(resolve => {
const script = document.createElement('script');
script.addEventListener('load', () => {
resolve();
});
script.src = url;
document.body.append(script);
});
loadScript('SOME_URL').then(() => {
console.log('Скрипт загружен');
});
const walker = document.createTreeWalker(document.body, NodeFilter.SHOW_TEXT);
while (walker.nextNode()) {
const text = walker.currentNode.textContent.trim();
if (text === '000-00-00') {
walker.currentNode.textContent = '111-11-11';
}
}
const parse = float => parseFloat(float.replace(/,/g, ''));
const number = parse(objectFloat.param1) + parse(objectFloat.param2); // 2353.66
console.log(number.toLocaleString('en-US')); // 2,353.66
let inputValue = document.querySelector('input');
let btn = document.getElementsByTagName('button');
let ulListPlan = document.getElementById('plan');
let clearComleted = document.getElementById('completed');
clearComleted.addEventListener('click', function () {
let completed = document.querySelectorAll('input[type="checkbox"]:checked');
for (let entry of completed) {
entry.parentNode.remove();
}
});
function createTodo(value) {
let li = document.createElement('li')
let checkBox = document.createElement('input');
let close = document.createElement('button');
let text = document.createTextNode(value);
close.textContent = "X";
checkBox.type = "checkBox";
checkBox.addEventListener('input', function () {
if (checkBox.checked) {
li.style.userSelect = 'none';
li.style.backgroundColor = 'grey'
} else {
li.style.backgroundColor = 'white';
li.style.userSelect = "text";
}
});
close.addEventListener('click', function () {
li.remove();
});
li.append(checkBox, text, close);
ulListPlan.append(li);
}
inputValue.addEventListener('keyup', function (event) {
if (event.keyCode == 13 && inputValue.value.length > 0) {
createTodo(inputValue.value);
inputValue.value = '';
}
});
self.convert = soup.find_all(class_="amount")
for entry in self.convert:
print(entry.get_text())
createLi.onclick
дописываете createLi.onclick = null;
doneList.ondblclick = function () {
doneList.removeChild(createLi);
}
меняете на createLi.ondblclick = function () {
createLi.remove();
}
.onclick
и прочее надо менять на .addEventListener
.