• 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.

Converting an old JS file into a module

Scheduled Pinned Locked Moved Troubleshooting
20 Posts 3 Posters 11.1k Views 3 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.
  • O Offline
    ooom416354
    last edited by Jan 30, 2017, 4:54 PM

    Hi all,

    I’ll preface this in saying I am a database developer and not a JavaScript developer at all but with some help from a fellow developer we did work on a file for the older mirror project that pulls data from an API into JSON format and displayed it on a webpage. It was a bit rough looking and not the best code but it worked. I have since moved on to using the MM2 and am wondering if someone would be able to help me convert this old code over to an actual working MM2 module. This particular process pulls down the train delay information from the MTA (NYC’s transit authority).

    Thank you to everyone here for all of your help so far!

    Y 1 Reply Last reply Jan 30, 2017, 5:05 PM Reply Quote 0
    • Y Offline
      yawns Moderator @ooom416354
      last edited by Jan 30, 2017, 5:05 PM

      @ooom416354
      Do you have a link to the old module?

      O 1 Reply Last reply Jan 30, 2017, 5:22 PM Reply Quote 0
      • O Offline
        ooom416354 @yawns
        last edited by Jan 30, 2017, 5:22 PM

        @yawns Sure, the code was added as part of jangellx’s mirror project.

        the actual JS file is located here

        https://github.com/jangellx/MagicMirror/blob/master/js/mm-mta.js

        1 Reply Last reply Reply Quote 0
        • Y Offline
          yawns Moderator
          last edited by Jan 30, 2017, 7:41 PM

          Okay, looks rather simple. Do you want to develop it yourself and just need a push into the right direction? Or do you want one of us to do the conversion?

          O 1 Reply Last reply Jan 30, 2017, 9:38 PM Reply Quote 1
          • O Offline
            ooom416354 @yawns
            last edited by Jan 30, 2017, 9:38 PM

            @yawns I think maybe if you guys are able to do the conversion I can then dive in and figure out how to go from one to the other. If I try to do it I think I’d get stuck too many times as I am pretty poor in JS. I really appreciate it!

            Y 1 Reply Last reply Jan 31, 2017, 10:04 AM Reply Quote 0
            • C Offline
              cowboysdude Module Developer
              last edited by Jan 30, 2017, 10:28 PM

              Looks like it just needs a vehicle to display the info in the MM…

              O 1 Reply Last reply Jan 31, 2017, 3:17 AM Reply Quote 0
              • O Offline
                ooom416354 @cowboysdude
                last edited by Jan 31, 2017, 3:17 AM

                @cowboysdude for the old MM we ended up using the other function that the developer wrote to refresh and display it on the page. I’m just not sure how I can display it on the MM2 or what I’d need to rewrite to get it to work.

                C 1 Reply Last reply Jan 31, 2017, 12:23 PM Reply Quote 0
                • Y Offline
                  yawns Moderator @ooom416354
                  last edited by yawns Jan 31, 2017, 10:12 AM Jan 31, 2017, 10:04 AM

                  @ooom416354
                  ok. Do you have an api key you could provide to me via chat/pm? Then I don’t need to request an own one just for testing purposes

                  Nevermind, I got one :)

                  1 Reply Last reply Reply Quote 1
                  • C Offline
                    cowboysdude Module Developer @ooom416354
                    last edited by Jan 31, 2017, 12:23 PM

                    @ooom416354 If you know js it’s easy…

                    https://github.com/MichMich/MagicMirror/tree/develop/modules

                    O 1 Reply Last reply Jan 31, 2017, 12:32 PM Reply Quote 0
                    • O Offline
                      ooom416354 @cowboysdude
                      last edited by Jan 31, 2017, 12:32 PM

                      @cowboysdude problem is I am so new to it and I don’t really know the best way to test without actually uploading everything to the Pi. I was using notepad++ to write but for testing I had used xampp for the MM1. That doesn’t work with node I don’t think right? I am a programmer but work mostly as a SQL developer so I never had a need for learning JavaScript. Is there any particular class, site, etc. I can start out with to learn and actually develop myself? Thanks.

                      1 Reply Last reply Reply Quote 0
                      • 1
                      • 2
                      • 1 / 2
                      1 / 2
                      • First post
                        1/20
                        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