Fix for "ReferenceError: globalPosition is not defined" warning

This commit is contained in:
Anthony J. Thibault 2017-01-24 11:40:20 -08:00
parent 432bb27119
commit d2f024e84d

View file

@ -7,7 +7,7 @@ Item {
property var eventBridge;
signal showDesktop();
function loadSource(url) {
loader.source = url;
}
@ -23,7 +23,11 @@ Item {
}
function playButtonClickSound() {
buttonClickSound.play(globalPosition);
// Because of the asynchronous nature of initalization, it is possible for this function to be
// called before the C++ has set the globalPosition context variable.
if (typeof globalPosition !== 'undefined') {
buttonClickSound.play(globalPosition);
}
}
Loader {