Помните, что мне нужно использовать это значение в функции экспорта, поэтому его нельзя записать внутри прослушивателя событий.
Код: Выделить всё
const sceneContainer = document.getElementById('scene-container');
const canvas = document.getElementById("three-canvas");
let transitionDuration;
let isExpanded = false;
document.addEventListener('DOMContentLoaded', function() {
transitionDuration = window.getComputedStyle(sceneContainer).getPropertyValue("transition-duration");
//returns 'Inside DOMContentLoaded: | 0.5s'
console.log("Inside DOMContentLoaded:", transitionDuration);
});
//returns undefined
console.log(transitionDuration)
.
.
.
export function expandScreen() {...}
Подробнее здесь: https://stackoverflow.com/questions/787 ... mcontentlo