Fix the dangling promises
This commit is contained in:
parent
27f918f53c
commit
041627f7e4
19 changed files with 112 additions and 67 deletions
|
@ -106,6 +106,6 @@ async function test1() {
|
|||
iterateOnSequence()
|
||||
}
|
||||
|
||||
test1().then(() => {
|
||||
void test1().then(() => {
|
||||
console.log('test1 done')
|
||||
})
|
||||
|
|
|
@ -35,14 +35,14 @@ function createBundles(watch: boolean) {
|
|||
// format: 'iife',
|
||||
// })
|
||||
|
||||
build({
|
||||
void build({
|
||||
...esbuildConfig,
|
||||
entryPoints: [path.join(pathToPackage, 'src/core-and-studio.ts')],
|
||||
outfile: path.join(pathToPackage, 'dist/core-and-studio.js'),
|
||||
format: 'iife',
|
||||
})
|
||||
|
||||
build({
|
||||
void build({
|
||||
...esbuildConfig,
|
||||
entryPoints: [path.join(pathToPackage, 'src/core-only.ts')],
|
||||
outfile: path.join(pathToPackage, 'dist/core-only.min.js'),
|
||||
|
|
|
@ -17,7 +17,7 @@ function createBundles(watch: boolean) {
|
|||
conditions: ['browser', 'node'],
|
||||
}
|
||||
|
||||
build({
|
||||
void build({
|
||||
...esbuildConfig,
|
||||
outfile: path.join(pathToPackage, 'dist/index.js'),
|
||||
format: 'cjs',
|
||||
|
|
|
@ -53,7 +53,7 @@ const ImageTypeExample: React.FC<{}> = (props) => {
|
|||
onClick={() => {
|
||||
if (sheet.sequence.position === 0) {
|
||||
sheet.sequence.position = 0
|
||||
sheet.sequence.play()
|
||||
void sheet.sequence.play()
|
||||
} else {
|
||||
sheet.sequence.position = 0
|
||||
}
|
||||
|
@ -64,6 +64,10 @@ const ImageTypeExample: React.FC<{}> = (props) => {
|
|||
)
|
||||
}
|
||||
|
||||
project.ready.then(() => {
|
||||
render(<ImageTypeExample />, document.getElementById('root'))
|
||||
})
|
||||
project.ready
|
||||
.then(() => {
|
||||
render(<ImageTypeExample />, document.getElementById('root'))
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err)
|
||||
})
|
||||
|
|
|
@ -7,7 +7,7 @@ import {Scene} from './Scene'
|
|||
studio.initialize()
|
||||
|
||||
// trigger warning notification
|
||||
getProject('Sample project').sheet('Scene').sequence.play()
|
||||
void getProject('Sample project').sheet('Scene').sequence.play()
|
||||
|
||||
// fire an info notification
|
||||
notify.info(
|
||||
|
@ -16,7 +16,7 @@ notify.info(
|
|||
'(and all others) at the start of index.tsx. You can also see examples of success and warnign notifications.',
|
||||
)
|
||||
|
||||
getProject('Sample project').ready.then(() => {
|
||||
void getProject('Sample project').ready.then(() => {
|
||||
// fire a success notification on project load
|
||||
notify.success(
|
||||
'Project loaded!',
|
||||
|
|
|
@ -3,7 +3,7 @@ import {render} from 'react-dom'
|
|||
import React, {useState} from 'react'
|
||||
import state from './state.json'
|
||||
|
||||
initialize({state})
|
||||
void initialize({state})
|
||||
|
||||
function SomeComponent({id}: {id: string}) {
|
||||
const {foo, $get, $set} = useControls(
|
||||
|
|
|
@ -76,7 +76,7 @@ function App() {
|
|||
const bg = bgs[bgIndex]
|
||||
const project = getProject('SpaceStress', {state})
|
||||
const sheet = project.sheet('Scene')
|
||||
project.ready.then(() => sheet.sequence.play({iterationCount: Infinity}))
|
||||
void project.ready.then(() => sheet.sequence.play({iterationCount: Infinity}))
|
||||
|
||||
const allPropsObj = sheet.object('All Props Tester', allPropsObjectConfig)
|
||||
console.log('allPropsObj', allPropsObj)
|
||||
|
|
|
@ -39,13 +39,13 @@ const elements = new Array(TOTAL_ELEMENTS).fill(0).map((_, idx) => {
|
|||
return {el, sheet, obj}
|
||||
})
|
||||
|
||||
project.ready.then(() => {
|
||||
void project.ready.then(() => {
|
||||
// select the playback controls obj so it shows as a tweakable control
|
||||
studio.setSelection([playbackControlObj])
|
||||
for (let i = 0; i < elements.length; i++) {
|
||||
const sheet = elements[i].sheet
|
||||
sheet.sequence.position = i * TOTAL_ELEMENTS_R * 5
|
||||
sheet.sequence.play({
|
||||
void sheet.sequence.play({
|
||||
iterationCount: Infinity,
|
||||
})
|
||||
}
|
||||
|
|
|
@ -8,11 +8,10 @@ const definedGlobals = {
|
|||
'process.env.NODE_ENV': JSON.stringify('production'),
|
||||
}
|
||||
|
||||
createBundles()
|
||||
void createBundles()
|
||||
|
||||
async function createBundles() {
|
||||
createMainBundle()
|
||||
createExtensionBundle()
|
||||
await Promise.all([createMainBundle(), createExtensionBundle()])
|
||||
|
||||
async function createMainBundle() {
|
||||
const pathToEntry = path.join(__dirname, '../src/index.ts')
|
||||
|
|
|
@ -24,7 +24,7 @@ const definedGlobals = {
|
|||
global: 'window',
|
||||
}
|
||||
|
||||
function createBundles(watch: boolean) {
|
||||
async function createBundles(watch: boolean) {
|
||||
const pathToPackage = path.join(__dirname, '../')
|
||||
const esbuildConfig: Parameters<typeof build>[0] = {
|
||||
entryPoints: [path.join(pathToPackage, 'src/index.ts')],
|
||||
|
@ -39,7 +39,7 @@ function createBundles(watch: boolean) {
|
|||
plugins: [externalPlugin([/^[\@a-zA-Z]+/])],
|
||||
}
|
||||
|
||||
build({
|
||||
await build({
|
||||
...esbuildConfig,
|
||||
outfile: path.join(pathToPackage, 'dist/index.js'),
|
||||
format: 'cjs',
|
||||
|
@ -52,4 +52,4 @@ function createBundles(watch: boolean) {
|
|||
// })
|
||||
}
|
||||
|
||||
createBundles(false)
|
||||
void createBundles(false)
|
||||
|
|
|
@ -24,7 +24,7 @@ const definedGlobals = {
|
|||
global: 'window',
|
||||
}
|
||||
|
||||
function createBundles(watch: boolean) {
|
||||
async function createBundles(watch: boolean) {
|
||||
const pathToPackage = path.join(__dirname, '../')
|
||||
const pkgJson = require(path.join(pathToPackage, 'package.json'))
|
||||
const listOfDependencies = Object.keys(pkgJson.dependencies || {})
|
||||
|
@ -52,7 +52,7 @@ function createBundles(watch: boolean) {
|
|||
],
|
||||
}
|
||||
|
||||
build({
|
||||
await build({
|
||||
...esbuildConfig,
|
||||
outfile: path.join(pathToPackage, 'dist/index.js'),
|
||||
format: 'cjs',
|
||||
|
@ -65,4 +65,4 @@ function createBundles(watch: boolean) {
|
|||
// })
|
||||
}
|
||||
|
||||
createBundles(false)
|
||||
void createBundles(false)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue