-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path65.js
29 lines (23 loc) · 772 Bytes
/
65.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
const loadScript = (src)=>{
let p = new Promise((resolve,reject)=>{
let script = document.createElement('script')
script.src = src
document.body.append(script)
script.onload = () =>{
resolve(1)
}
script.onerror = () =>{
reject(0)
console.log('Unable to load')
}
})
return p
}
let p1 = loadScript('https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js')
p1.then((value)=>{
console.log(value)
return loadScript('https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js')
}).catch((error)=>{
console.log('ERRROR OCCURED')
})
// Put .catch at last as if any of .then fails it will get to next closet .catch