MagicMirror² v2.14.0 is available! For more information about this release, check out this topic.

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

  • Project Sponsor Module Developer

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

  • I’m ashamed…


Log in to reply