compile-hero
compile-hero copied to clipboard
Promise not compiling
HI, when trying to write a promise using async await i'm getting this error after compiling: "ReferenceError: regeneratorRuntime is not defined"
Is there a way around this or should i just avoid using a promise?
TIA
Hi, Can you provide the complete code to be compiled?
Yeah sure,
barba.init({
sync: true,
debug: true,
transitions: [{
async leave() {
const done = this.async();
pageOut();
await delay(1000);
done();
},
async enter() {
pageIn();
},
async once() {
pageIn();
}
}]
})
const delay = t => {
t = t || 1000;
return new Promise((done) => {
setTimeout(() => {
done();
}, t)
})
}
const pageIn = e => {
const tl = gsap.timeline();
tl.set('.content', { opacity: 0 })
tl.to('.content', { opacity: 1 })
}
const pageOut = e => {
const tl = gsap.timeline();
tl.to('.content', { opacity: 0 })
}
using barba.js and gsap for transitions
babel-polyfill
(deprecated as of Babel 7.4) is required. You must also install it in order to get async/await
working.
https://stackoverflow.com/questions/33527653/babel-6-regeneratorruntime-is-not-defined