Audio subscribe method

subscribe(
  callback: (isEnabled: boolean) => void
): void

Subscribes to changes to isEnabled. callback will be called with the value of isEnabled when it changes.

Examples

engine.sound.setMute(!GameSnacks.audio.isEnabled);
GameSnacks.audio.subscribe((isEnabled) => engine.sound.setMute(!isEnabled));

Requirements

See isEnabled.