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-Stock Cannot read property 'toLowerCase'

    Scheduled Pinned Locked Moved Troubleshooting
    34 Posts 2 Posters 9.7k 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.
    • B Offline
      brendan_c23 @brendan_c23
      last edited by

      @brendan_c23 Uncaught TypeError: Cannot read property ‘toLowerCase’ of undefined

      S 1 Reply Last reply Reply Quote 0
      • S Offline
        sdetweil @brendan_c23
        last edited by

        @brendan_c23 you are only changing one word
        ‘this’ to the word ‘that’ on one line

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        B 1 Reply Last reply Reply Quote 0
        • B Offline
          brendan_c23 @sdetweil
          last edited by

          @sdetweil Yes I made that change, but the error was still coming up for me

          S 1 Reply Last reply Reply Quote 0
          • S Offline
            sdetweil @brendan_c23
            last edited by

            @brendan_c23 show me those 10 lines

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            B 1 Reply Last reply Reply Quote 0
            • B Offline
              brendan_c23 @sdetweil
              last edited by

              @sdetweil //if another currency is required - usd is default
              var differentCurrency = false;
              if(that.config.currency.toLowerCase() != “usd”){
              differentCurrency = true;
              var requiredCurrency = this.config.currency.toUpperCase();
              }

              	for (var key in data) {
              		if (!data.hasOwnProperty(key)) {continue;}
              		var symbol = key;
              		var obj = data[key];
              		var current = obj[0];
              		var prev = obj[1];
              		var price = current["4. close"];
              		var change = prev["4. close"] - current["4. close"];
              
              		var html = "";
              		var priceClass = "greentext", priceIcon="up_green";
              		if(change < 0) {
              			priceClass = "redtext";
              			priceIcon="down_red";
              		}
              
              S 1 Reply Last reply Reply Quote 0
              • S Offline
                sdetweil @brendan_c23
                last edited by

                @brendan_c23 no, these, around line 90

                	scheduleUpdate: function(delay) {
                		var loadTime = this.config.updateInterval;
                		if (typeof delay !== "undefined" && delay >= 0) {
                			loadTime = delay;
                		}
                
                		var that = this;
                		setInterval(function() {
                			that.getStocks();
                			if(that.config.currency.toLowerCase() != "usd"){ // line 90 changed
                				that.getExchangeRate();
                			}
                		}, loadTime);
                	},
                

                Sam

                How to add modules

                learning how to use browser developers window for css changes

                B 1 Reply Last reply Reply Quote 0
                • B Offline
                  brendan_c23 @sdetweil
                  last edited by

                  @sdetweil Ok, I changed the ‘this’ to ‘that’ some lines above! not on those lines, going to try running it after changing the line you just sent

                  S 1 Reply Last reply Reply Quote 0
                  • S Offline
                    sdetweil @brendan_c23
                    last edited by

                    @brendan_c23 just the ONE line, line 90…

                    Sam

                    How to add modules

                    learning how to use browser developers window for css changes

                    B 1 Reply Last reply Reply Quote 1
                    • B Offline
                      brendan_c23
                      last edited by

                      @sdetweil still waiting to see if it will display, theres a big delay, but no errors have popped up yet

                      scheduleUpdate: function(delay) {
                      var loadTime = this.config.updateInterval;
                      if (typeof delay !== “undefined” && delay >= 0) {
                      loadTime = delay;
                      }

                      	var that = this;
                      	setInterval(function() {
                      		that.getStocks();
                      		if(that.config.currency.toLowerCase() != "usd"){
                      			that.getExchangeRate();
                      		}
                      	}, loadTime);
                      },
                      
                      1 Reply Last reply Reply Quote 0
                      • B Offline
                        brendan_c23 @sdetweil
                        last edited by

                        @sdetweil No errors have come up, but it also has not displayed, have been waiting for around 10 minutes

                        S 1 Reply Last reply Reply Quote 0
                        • 1
                        • 2
                        • 3
                        • 4
                        • 3 / 4
                        • 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