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.

    Beginner. Trying to make a simple module

    Scheduled Pinned Locked Moved Development
    3 Posts 2 Posters 2.5k Views 2 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.
    • T Offline
      Trentent
      last edited by

      Hello, I am looking to create a module that does something simple. It’s going to query a URL for a JSON file than output the result of some property of that file. So I’m looking at ‘weatherforecast’ and a couple other modules because they seem to be doing something similar for what I want to achieve.

      I’m trying to understand the “manual” https://github.com/MichMich/MagicMirror/tree/master/modules

      And I’m stuck here:

      *getScripts()

      Should return: Array

      The getScripts method is called to request any additional scripts that need to be loaded. This method should therefore return an array with strings. If you want to return a full path to a file in the module folder, use the this.file(‘filename.js’) method. In all cases the loader will only load a file once. It even checks if the file is available in the default vendor folder.*

      So I can create some .js with some actions and I put this script within this method and it’ll ‘load’ it?

      Ok, seems reasonable. Let’s look at weatherforecast.js:

      0_1480346827595_Screen Shot 2016-11-28 at 8.26.50 AM.png

      Ok, it’s returning a file called ‘moment.js’. The comments say “// this file is available in the vendor folder, so it doesn’t need to be avialable(sic) in the module folder.”

      So I look in the vendor folder, there is a moment folder and a vendor.js file that appears to link ‘moment.js’ to the actual file “moment-with-locales.js”.

      Then I look at moment.js and what is it doing? What does moment.js do? Is there better documentation then trying to read the javascript?

      Thanks!

      strawberry 3.141S 1 Reply Last reply Reply Quote 0
      • strawberry 3.141S Offline
        strawberry 3.141 Project Sponsor Module Developer @Trentent
        last edited by

        @Trentent http://momentjs.com/

        Please create a github issue if you need help, so I can keep track

        1 Reply Last reply Reply Quote 0
        • T Offline
          Trentent
          last edited by

          Cool, thank you!

          1 Reply Last reply Reply Quote 0

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          • 1 / 1
          • First post
            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