Fix the dangling promises

This commit is contained in:
Aria Minaei 2023-08-03 10:46:36 +02:00
parent 27f918f53c
commit 041627f7e4
19 changed files with 112 additions and 67 deletions

View file

@ -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)
})

View file

@ -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!',

View file

@ -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(

View file

@ -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)

View file

@ -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,
})
}