onLoad(action: ()=>void): void

Register an event that runs when all assets finished loading.

paramaction- The function to run when the event is triggered.

const bean = add([
    sprite("bean"),
])

// certain assets related data are only available when the game finishes loading
onLoad(() => {
    debug.log(bean.width)
})

returnsThe event controller.

sincev2000.1