Get an existing JavaScript game to work on the MagicMirror



  • Hi!

    I was wondering about if it’s possible to use an existing JavaScript game (like this one, for example: https://github.com/luciopanepinto/pacman ) and turn it into a MagicMirror module.

    I have a bit of programming experiences with other languages but I’m only beginning to learn JavaScript and the whole MagicMirror module concept.

    How would I be able to achieve this?

    Thanks in advance!


  • Module Developer

    @tuxx1112
    A very simple solution is, including it into a simple iFrame.



  • Thank you for your reply.

    Is an iFrame not used only for web applications? I am trying to implement a JavaScript game that is not hosted on a web server.
    Or is it easier to just host the game on a web server and then use an iFrame for that?

    Thanks in advance!


  • Module Developer

    @tuxx1112
    My answer is, “hosting a web server, that is the easiest way.”.

    I have no idea about your “Javascript” game whether it means “browser-leveled” pure javascript or node.js or something else.
    If your game is just coded with a simple front-end javascript, you can easily implement that script with a module.
    If your game is coded for using H/W itself (not browser-level), experienced skill will be needed to implement. But I cannot be sure of it’s success.



  • @tuxx1112 said in Get an existing JavaScript game to work on the MagicMirror:

    Thank you for your reply.

    Is an iFrame not used only for web applications? I am trying to implement a JavaScript game that is not hosted on a web server.
    Or is it easier to just host the game on a web server and then use an iFrame for that?

    In my opinion. It doesn’t matter whether you first host your web application and then use iFrame or you do it the other way. It is solely your choice on how you do it. Like for instance I first host my web application on the managed digitalOcean server which is powered by Cloudways and then used the iframe for that.
    But, I do think that both ways are easier if you know how to do it.