MagicMirror² v2.4.1 is available! For more information about this release, check out this topic.
Please read the release notes carefully since this update requires adjustments to your Raspberry Pi configuration!

setTimeout called only once in node_helper.js

  • Hi,

    I’m getting crazy with this, read stackoverflow, articles and still I cannot success to do a simple timeout.
    In the last version of my plugin,
    this code is called once and in the console I’ll see only one “boo”

    setTimeout(function () {
    }, 100);

    Then nothing in the console, others modules work fine, but not mine (it works but never refreshs)

    here is the full code

    const NodeHelper = require("node_helper");
    const forge = require('node-forge');
    const unirest = require('unirest');
    module.exports = NodeHelper.create({
    		start: function () {
    	    		this.started = false;
    			console.log("MMM-Ratp- NodeHelper started");
    		socketNotificationReceived: function(notification, payload) {
    setTimeout(function () {
    }, 100);

    what could causes this ? I tried everything, started from scratch but always the same issue

  • @bobbob601 a timeout is only fired once, what you want is an interval so replace setTimeout with setInterval

  • I’m ashamed…