In my app, I have a global player. In the shell module, I require the viewmodel of the player because I want to know if the player is playing, and if so, I add a class to container of the app (which is in the shell).
The problem is that I also need to require the shell from the player VM, because there are some functions that I use across the app that are in the shell.
But when requiring the player module from the shell, requiring the shell from the player returns undefined
. If I don't require the player, the shell is passed normally.
shell.js
define(['viewmodels/player'], function(player) {
return {
player: player
}
})
player.js
define(['viewmodels/shell'], function(shell) {
console.log('shell:', shell) // undefined
})
I don't have any ideia of what's going on.