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.

    MMM-Wunderlist-Enhanced javascript error

    Scheduled Pinned Locked Moved Troubleshooting
    14 Posts 2 Posters 4.6k 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.
    • G Offline
      geeklimit
      last edited by

      Running MMM-Wunderlist-Enhanced via PM2 on Raspbian Jessie Lite. MM 2.1.3 and Electron 1.4.5.

      MMM-Wunderlist-Enhanced doesn’t show on screen. Checking PM2 error logs shows:

      ** Message: console message: [native code] @0: Load script: modules/MMM-Wunderlist-Enhanced//MMM-Wunderlist-Enhanced.js
      
      ** Message: console message: http://localhost:8080/modules/MMM-Wunderlist-Enhanced//MMM-Wunderlist-Enhanced.js @59: SyntaxError: Unexpected token '>'
      

      I’ve tried the following, just to make sure all dependencies and files are up to date and correct:

      pi@kitchenpi:~/MagicMirror/modules/MMM-Wunderlist-Enhanced $ git fetch --all
      Fetching origin
      pi@kitchenpi:~/MagicMirror/modules/MMM-Wunderlist-Enhanced $ git reset --hard origin/master
      HEAD is now at 4f01f5d Update README.md
      pi@kitchenpi:~/MagicMirror/modules/MMM-Wunderlist-Enhanced $ npm install
      up to date in 37.436s
      

      Seems OK. The section of code in MMM-Wunderlist-Enhanced.js that’s giving the problem is:

          this.config.lists.forEach((listValue, listKey) => {
      

      and in context here (line 59):

        getTodos: function() {
          var tasks = [];
          this.config.lists.forEach((listValue, listKey) => {
            let list = this.tasks[listValue];
            if (list && list.length)
              list.forEach(todo => {
                if (this.config.order === 'reversed') {
                  tasks.push(todo);
                } else {
                  tasks.unshift(todo)
                }
      

      It seems like the ‘=>’ is the problem?

      I’m not a javascript coder, so I can’t tell if it’s supposed to be that way or not.

      I tried changing it to just ‘=’, but that doesn’t fix the problem.

      ? 2 Replies Last reply Reply Quote 0
      • ? Offline
        A Former User @geeklimit
        last edited by

        @geeklimit what is your device? => is ES6 style syntax, so old js engine cannot parse it.

        1 Reply Last reply Reply Quote 0
        • G Offline
          geeklimit
          last edited by

          It’s a Pi Zero W.

          pi@kitchenpi:~/MagicMirror/modules/MMM-NOAA $ npm version
          { 'mmm-noaa': '1.0.0',
            npm: '5.4.2',
            ares: '1.10.1-DEV',
            cldr: '31.0.1',
            http_parser: '2.7.0',
            icu: '59.1',
            modules: '57',
            node: '8.3.0',
            openssl: '1.0.2l',
            tz: '2017b',
            unicode: '9.0',
            uv: '1.13.1',
            v8: '6.0.286.52',
            zlib: '1.2.11' }
          

          Looks like node is at version 8.3.0.

          So…downgrade node or update the syntax?

          ? 1 Reply Last reply Reply Quote 0
          • ? Offline
            A Former User
            last edited by

            You can modify that with old style like this.

            (...)=>{...}
            

            to

            function (...) {...}
            
            1 Reply Last reply Reply Quote 0
            • ? Offline
              A Former User @geeklimit
              last edited by

              @geeklimit I think pi zewo would use Midori instead Chromium as default browser. So you can try my above solution.

              1 Reply Last reply Reply Quote 0
              • ? Offline
                A Former User
                last edited by

                Watchout! You should change all of this to self in function and prepend var self = this before function.

                1 Reply Last reply Reply Quote 0
                • G Offline
                  geeklimit
                  last edited by

                  I am using Midori as part of my startup script. Specifically:

                  #!/bin/sh
                  
                  unclutter &
                  xset -dpms # disable DPMS (Energy Star) features.
                  xset s off # disable screen saver
                  xset s noblank # don’t blank the video device
                  matchbox-window-manager &
                  midori -e Fullscreen -a http://localhost:8080
                  
                  ? 1 Reply Last reply Reply Quote 0
                  • ? Offline
                    A Former User @geeklimit
                    last edited by

                    @geeklimit can you change midori to chromium? I think its easier than code modifying.

                    1 Reply Last reply Reply Quote 0
                    • G Offline
                      geeklimit
                      last edited by

                      You’re losing me, but I think you mean I should edit the line causing the error from:

                      this.config.lists.forEach((listValue, listKey) => {
                      

                      to

                      this.config.lists.forEach ((listValue, listKey) {
                      

                      Or does this section of the code need a complete rewrite?

                      ? 1 Reply Last reply Reply Quote 0
                      • ? Offline
                        A Former User @geeklimit
                        last edited by

                        @geeklimit sorry but i think there is not the only place where es6 style used. You should find and modify every place of that kinds. Browser changing is more easier.

                        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 Sam, technical setup by Karsten.
                        This forum is using NodeBB as its core | Contributors
                        Contact | Privacy Policy