• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
MagicMirror Forum
  • Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.

Module programming preview, jsfiddle?

Scheduled Pinned Locked Moved General Discussion
11 Posts 5 Posters 7.1k Views 5 Watching
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.
  • M Offline
    morozgrafix Moderator
    last edited by Jan 30, 2017, 10:17 PM

    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 Jan 31, 2017, 12:33 PM Reply Quote 3
    • W Offline
      washichi @morozgrafix
      last edited by Jan 31, 2017, 12:33 PM

      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?

      M 1 Reply Last reply Jan 31, 2017, 7:32 PM Reply Quote 0
      • M Offline
        morozgrafix Moderator @washichi
        last edited by Jan 31, 2017, 7:32 PM

        @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 Feb 1, 2017, 10:28 AM Reply Quote 0
        • W Offline
          washichi @morozgrafix
          last edited by Feb 1, 2017, 10:28 AM

          @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

          M 1 Reply Last reply Feb 1, 2017, 6:23 PM Reply Quote 0
          • M Offline
            morozgrafix Moderator @washichi
            last edited by morozgrafix Feb 1, 2017, 6:24 PM Feb 1, 2017, 6:23 PM

            @washichi Interesting idea for the module. And glancing at your code you seem to be on the right track.

            I may be not understanding what you trying Sublime Text to do. It’s just a text editor with ability to add various packages on top of it. It’s not a full blown IDE. I don’t believe that you can compile or preview the JavaScript module directly in Sublime.

            My general workflow for module creation is something like this:

            1. Create MMM-mymodule directory inside MagicMirror/modules
            2. Open MagicMirror directory in sublime
            3. Add barebones config for the module to modules array in config.js, for example:
            {
            	module: "MMM-mymodule",
            	position: "bottom_right",
            	config : {
            		
            	}
            },
            
            1. Start node serveronly and point my Chrome with dev tools open to the http://localhost:8080
            2. Create/edit MagicMirror/modules/MMM-mymodule/MMM-mymodule.js, save it. (or other files that you need for the module)
            3. Refresh the browser to pickup my changes, debug etc.
            4. Repeat steps 5-6 as I go along. If adding/editing node_helper.js repeat steps 4-6 since node needs to pickup that file.

            Some of restarts/refreshes can be automated on file save with different tools, but I’m not going to get into that right now.

            1 Reply Last reply Reply Quote 3
            • 1
            • 2
            • 2 / 2
            2 / 2
            • First post
              11/11
              Last post
            Enjoying MagicMirror? Please consider a donation!
            MagicMirror created by Michael Teeuw.
            Forum managed by Sam, technical setup by Karsten.
            This forum is using NodeBB as its core | Contributors
            Contact | Privacy Policy