# Function: restoreDiffMaybeOffloaded() (/pixi-vn/index/functions/restoreDiffMaybeOffloaded)



\> **restoreDiffMaybeOffloaded**\<`T`>(`state`, `stateDiff`): `Promise`\<`T`>

Defined in: [src/worker/offload.ts:13](https://github.com/DRincs-Productions/pixi-vn/blob/5bb5bb1f92e38998ea2f477b600168d8da3ece19/src/worker/offload.ts#L13)

Applies `stateDiff` to `state`, via the registered game worker if one is available (see
`Game.worker`), falling back to computing it synchronously on the main thread otherwise -
whether that's because no worker was registered, or because the worker call itself failed (the
caller should never hard-fail just because the optional worker hiccuped).

## Type Parameters [#type-parameters]

### T [#t]

`T` *extends* `object`

## Parameters [#parameters]

### state [#state]

`T`

### stateDiff [#statediff]

`Difference`\[]

## Returns [#returns]

`Promise`\<`T`>
