Read the statement by Michael Teeuw here.
MMM-Stock Cannot read property 'toLowerCase'
-
@sdetweil Could you help guide me on how to fix the code? Would you like me to post the .js file?
-
@brendan_c23 which module is that
this one works fine (with the example stocks)
-
@brendan_c23 ok, I see the error on refresh…
change line 90 from
if(this.config.currency.toLowerCase() != "usd"){
to
if(that.config.currency.toLowerCase() != "usd"){
-
@sdetweil Hey I tried that, now it says Cannot read property ‘toLowerCase’ of undefined at MMM-stock.js:90
Any other suggestions?u are only changing the word this to the word that on that one line
-
@brendan_c23 Uncaught TypeError: Cannot read property ‘toLowerCase’ of undefined
-
@brendan_c23 you are only changing one word
‘this’ to the word ‘that’ on one line -
@sdetweil Yes I made that change, but the error was still coming up for me
-
@brendan_c23 show me those 10 lines
-
@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"; }
-
@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); },