// SPDX-FileCopyrightText: 2021 Johannes Loher
//
// SPDX-License-Identifier: MIT

export default function registerForUpdateSceneHook() {
  Hooks.on('updateScene', onUpdateScene);
}

function onUpdateScene(scene, change) {
  if (change.darkness != null) {
    scene.getEmbeddedCollection('Token').forEach((tokenDocument) => tokenDocument.object.updateSource());
  }
}