MagicMirror Forum

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • Donate
    • Discord

    Module programming preview, jsfiddle?

    General Discussion
    5
    11
    5120
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • W
      washichi last edited by

      Hi all.
      I am wondering you you guys are developing the modules for the magicmirror.
      I have no experience in JavaScript, so I’m all new her (but have coding experience in other languages)

      Can anyone give me some advice about how to setup a coding environment for the modules?
      I’m now coding in sublime3 with some plugins, so I have syntax highlighting.
      but can I get a module preview in my browser, something like https://jsfiddle.net/,
      or can I preview modules in jsfiddle?
      Or is this not possible and for a preview of my module I need to scp it to my pi?

      If you guys can tell me how you do it that would help my alot.
      all other information/help is welcome, cause I’m totally new to javascript.

      1 Reply Last reply Reply Quote 0
      • broberg
        broberg Project Sponsor last edited by

        Personally I have a smb share on my pi so I can get to the files directly, and then I just let the MM run on the pi and either test the modules on the pi itself or accessing it via the browser on my desktop.

        I use Atom at the moment, but it’s a little overkill for me, would do just fine with a regular text-editor but notepad doesn’t handle the files to well, it just fucks up the tabbing etc.

        1 Reply Last reply Reply Quote 0
        • W
          washichi last edited by

          A okay, yeah I was thinking about kinda the same setup but was wondering if I could get a preview without the PI.

          I found out that http://liveweave.com/ can compile in the browser.
          so that’s handy for some fast checks.

          1 Reply Last reply Reply Quote 0
          • cowboysdude
            cowboysdude Module Developer last edited by

            I use my windows machine with node.js installed as well as MM… I use code lobster to do code so I just test it that way…

            of course the infamous ‘npm start dev’…

            I’m sure there are other ways but that’s how I roll 🙂

            yawns 1 Reply Last reply Reply Quote 0
            • yawns
              yawns Moderator @cowboysdude last edited by

              @cowboysdude
              I do the same. I am running node.js on my windows machine and develop in Visual Studio Code. The only thing you cannot test using this method is access to GPIO connected things (PIR sensor, PI camera, …)

              cowboysdude 1 Reply Last reply Reply Quote 3
              • cowboysdude
                cowboysdude Module Developer @yawns last edited by

                @yawns I may have a look at the editor you use… the one I use is okay but I think the one you’re using is a bit more refined 🙂

                1 Reply Last reply Reply Quote 0
                • morozgrafix
                  morozgrafix Moderator last edited by

                  I just stick with SublimeText 3 on my MacBook and develop most of the stuff while running node serveronly and pointing Chrome at localhost:8080. Been using sublime with tons of add-on packages (including code linters) for years now and very happy with it. When things are ready I SSH to my RasPi and test on it. As @yawns said, the only drawback of this is that you can’t work with GPIO and other RasPi proprietary things while developing locally. I haven’t ran into many problems with that. There is also an scp package that can copy files to remote on save, I use that when I need to run directly on RasPi.

                  W 1 Reply Last reply Reply Quote 3
                  • W
                    washichi @morozgrafix last edited by

                    Can you tell me what plugins you use in Sublime3?

                    I have sublimelinter installed, and that works, but it isn’t complete:
                    I called “this.config.updateInterval” and didn’t have updateinterval defined, but didn’t get an error :(.

                    and if I build my module I get:

                    Module.register("ISS-current-location",{
                    ^
                    
                    ReferenceError: Module is not defined
                    

                    Anyway to ignore that error?

                    morozgrafix 1 Reply Last reply Reply Quote 0
                    • morozgrafix
                      morozgrafix Moderator @washichi last edited by

                      @washichi TBH I have too many to list. (for this project I mostly use SublimeLinter main package in combination with SublimeLinter-contrib-eslint, also use PrettyJSON for validation and formatting cleanup)

                      Where are you getting this error? What’s your MagicMirror/modules directory structure looks like?

                      W 1 Reply Last reply Reply Quote 0
                      • W
                        washichi @morozgrafix last edited by

                        @morozgrafix I am getting the error in sublime3. when only building mmm-module.js
                        (so I think my magicmirror/modules directory is not really relevant)

                        Iḿ now just trying to create a good sublime3 environment to compile my modules.
                        So ill take a look atht the packages you mentioned.
                        Since I’m new to javascript I think that will help me to get some basic errors out.

                        now trying to make an ISStracker module:
                        https://github.com/washichi/MMM-ISS-current-location
                        but it’s not showing on my magicmirror yet :p

                        morozgrafix 1 Reply Last reply Reply Quote 0
                        • 1
                        • 2
                        • 1 / 2
                        • First post
                          Last post
                        Enjoying MagicMirror? Please consider a donation!
                        MagicMirror created by Michael Teeuw.
                        Forum managed by Paul-Vincent Roll and Rodrigo Ramírez Norambuena.
                        This forum is using NodeBB as its core | Contributors
                        Contact | Privacy Policy