<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[error loop]]></title><description><![CDATA[<p dir="auto">first of all  hello :)</p>
<p dir="auto">i make my  module and i have  2 looping error but she is not located on my code<br />
<img src="/assets/uploads/files/1534504349716-erno.png" alt="alt text" class=" img-fluid img-markdown" /></p>
<p dir="auto">do you have idea?<br />
thk for your attention</p>
]]></description><link>https://forum.magicmirror.builders/topic/8601/error-loop</link><generator>RSS for Node</generator><lastBuildDate>Thu, 14 May 2026 20:30:29 GMT</lastBuildDate><atom:link href="https://forum.magicmirror.builders/topic/8601.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 17 Aug 2018 11:15:40 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to error loop on Mon, 20 Aug 2018 07:21:34 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jchenaud" aria-label="Profile: jchenaud">@<bdi>jchenaud</bdi></a><br />
<code>MODULE_DOM_CREATED</code> is not so good time. Because, It would be emitted when Your DOM was created, but All of other DOMs are not rendered yet. <code>DOM_OBJECTS_CREATED</code> is better.<br />
If you want to using <code>position</code>, use <code>.getDom()</code>. A usual way to use position is, in <code>.getDom()</code> to initialize your rendering and to prepare the framework to draw.<br />
And you can choose one of drawing tricks.</p>
<ol>
<li>
<p dir="auto"><code>getDom()</code> shall take care of all the drawing. in <code>.getDom()</code> put all of your rendering framework and contents. and you can refresh your render by calling <code>.updateDom()</code></p>
</li>
<li>
<p dir="auto"><code>getDom()</code> shall draw only framework, Contents should be drawn by your another function with HTML DOM manipulation.</p>
</li>
<li>
<p dir="auto">or <code>getDom()</code> just return empty wrapper, Then, all of your rendering and refreshing will be performed by yourself.</p>
</li>
</ol>
<p dir="auto">Which is better? case-by-case.</p>
<p dir="auto">For the last question; I cannot figure out. :)</p>
]]></description><link>https://forum.magicmirror.builders/post/43581</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/43581</guid><dc:creator><![CDATA[[[global:former-user]]]]></dc:creator><pubDate>Mon, 20 Aug 2018 07:21:34 GMT</pubDate></item><item><title><![CDATA[Reply to error loop on Mon, 20 Aug 2018 07:06:16 GMT]]></title><description><![CDATA[<p dir="auto">@Sean you are awesome !!!<br />
my module almost work</p>
<p dir="auto">just one problem i need to give a position in config. i think i have miss something</p>
<pre><code>Module.register("MMM-keylogger",{
	defaults: {
		 updateInterval:  1500,
	},

	notificationReceived: function(noti, payload, sender) {
		Log.log(`notif : ${noti}`);
		switch(noti) {
		  case 'MODULE_DOM_CREATED':
			this.initMyDOM()
			break
		}
	  },
	  initMyDOM: function() {
		var wrapper = document.createElement("div")
		wrapper.id = "myDOM"
		var container = document.body
		container.appendChild(wrapper)
		Log.log(`init DOM `);
		var timer = setInterval(()=&gt;{
			var d = document.getElementById("myDOM")
			d.innerHTML =  this.dataFile
		Log.log(`key : ${d.innerHTML} , ${this.dataFile} `);
			if(d.innerHTML){
				switch(d.innerHTML) {
					case "Right":
					this.sendNotification("PAGE_INCREMENT");
						break;
					case "Left" :
					this.sendNotification("PAGE_DECREMENT");
						break;
					default:
					Log.log(`key : ${d.innerHTML} pressed but not assigned`);
				}
				this.sendSocketNotification("Clear_key")
			}
			
			}, 1500)
	},

	start: function(){
        console.log(this.name + " has started...!!!!!!");
		this.sendSocketNotification("START", this.config);
	},

	socketNotificationReceived: function(notification, payload) {
		if(notification === "KEY_P"){
			this.dataFile = payload;
			// this.updateDom();
        }
	},
</code></pre>
<p dir="auto">if i don’t give position on config  its don’t work ! if i have understand what you have say. this is  suppose to work</p>
<p dir="auto">other question : one of my other module have subitly stop to work and make same error but in this module in need position and update with Miror display.  so  my question is   : this is possible this modification have impact on other module ?</p>
]]></description><link>https://forum.magicmirror.builders/post/43580</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/43580</guid><dc:creator><![CDATA[jchenaud]]></dc:creator><pubDate>Mon, 20 Aug 2018 07:06:16 GMT</pubDate></item><item><title><![CDATA[Reply to error loop on Fri, 17 Aug 2018 14:57:04 GMT]]></title><description><![CDATA[<p dir="auto">thk i will try :)</p>
]]></description><link>https://forum.magicmirror.builders/post/43521</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/43521</guid><dc:creator><![CDATA[jchenaud]]></dc:creator><pubDate>Fri, 17 Aug 2018 14:57:04 GMT</pubDate></item><item><title><![CDATA[Reply to error loop on Fri, 17 Aug 2018 14:34:48 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jchenaud" aria-label="Profile: jchenaud">@<bdi>jchenaud</bdi></a> I think that is also caused by unproper using of <code>.getDom()</code><br />
Better practice is;</p>
<ol>
<li>use <code>.getDom()</code> with proper position</li>
<li>or, not using <code>.getDom()</code>.</li>
</ol>
<ul>
<li>You can start to manipulate your DOM when <code>DOM_OBJECTS_CREATED</code> notification from MM Core.<br />
like these;</li>
</ul>
<pre><code class="language-javascript">notificationReceived: function(noti, payload, sender) {
  switch(noti) {
    case 'DOM_OBJECTS_CREATED':
      this.initMyDOM()
      break
  }
},
initMyDOM: function() {
  var wrapper = document.createElement("div")
  wrapper.id = "myDOM"
  var container = document.body
  container.appendChild(wrapper)
  
 var timer = setInterval(()=&gt;{
  var d = document.getElementById("myDOM")
  d.innerHTML = "This is rendered without getDom and position"
  }, 1000)
}

</code></pre>
<p dir="auto">This is not tested on real device, but you can catch the idea.</p>
]]></description><link>https://forum.magicmirror.builders/post/43519</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/43519</guid><dc:creator><![CDATA[[[global:former-user]]]]></dc:creator><pubDate>Fri, 17 Aug 2018 14:34:48 GMT</pubDate></item><item><title><![CDATA[Reply to error loop on Fri, 17 Aug 2018 14:20:16 GMT]]></title><description><![CDATA[<p dir="auto">@sean<br />
thk for explain. i will try something different to get<code>.getDom().</code></p>
<p dir="auto">have you an idea for  <code> appendChild</code> error ?</p>
]]></description><link>https://forum.magicmirror.builders/post/43518</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/43518</guid><dc:creator><![CDATA[jchenaud]]></dc:creator><pubDate>Fri, 17 Aug 2018 14:20:16 GMT</pubDate></item><item><title><![CDATA[Reply to error loop on Fri, 17 Aug 2018 13:39:36 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jchenaud" aria-label="Profile: jchenaud">@<bdi>jchenaud</bdi></a><br />
If your module doesn’t need to possess area in MagicMirror (even your module would draw something on MM), you wouldn’t use <code>.getDom()</code>. That function should be called by MM.core when the refreshing screen is needed. but your <code>.getDom()</code> will not work properly because there is no position to be drawn on.<br />
So you should assign a position to use <code>.getDom()</code>.<br />
(Of course, there is some trick without <code>.getDom()</code> and <code>position</code> to draw something on MM)</p>
]]></description><link>https://forum.magicmirror.builders/post/43514</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/43514</guid><dc:creator><![CDATA[[[global:former-user]]]]></dc:creator><pubDate>Fri, 17 Aug 2018 13:39:36 GMT</pubDate></item><item><title><![CDATA[Reply to error loop on Fri, 17 Aug 2018 13:30:10 GMT]]></title><description><![CDATA[<p dir="auto">@Sean</p>
<p dir="auto">thanks you have  suppress the first error on screen-shot<br />
but my modul write something on screen and i don’t want that but its can be cool for debug</p>
]]></description><link>https://forum.magicmirror.builders/post/43513</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/43513</guid><dc:creator><![CDATA[jchenaud]]></dc:creator><pubDate>Fri, 17 Aug 2018 13:30:10 GMT</pubDate></item><item><title><![CDATA[Reply to error loop on Fri, 17 Aug 2018 12:55:38 GMT]]></title><description><![CDATA[<p dir="auto">Have you assigned proper position for that module in <code>config.js</code>?</p>
]]></description><link>https://forum.magicmirror.builders/post/43512</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/43512</guid><dc:creator><![CDATA[[[global:former-user]]]]></dc:creator><pubDate>Fri, 17 Aug 2018 12:55:38 GMT</pubDate></item><item><title><![CDATA[Reply to error loop on Fri, 17 Aug 2018 12:04:10 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/doublet" aria-label="Profile: doublet">@<bdi>doublet</bdi></a><br />
i am not sure to understand</p>
<p dir="auto">if i remove my module i have one error (i correct after if i can)</p>
<p dir="auto">but the looping are ok</p>
<p dir="auto">my module</p>
<pre><code>Module.register("MMM-keylogger",{
	curentPage: -1,
	defaults: {
		updateInterval:  1000,
	},

	start: function(){
        console.log(this.name + " has started...!!!!!!");
		this.sendSocketNotification("START", this.config);
	},

	socketNotificationReceived: function(notification, payload) {
		if(notification === "KEY_P"){
			this.dataFile = payload;
			this.updateDom();
        }
	},

	getDom: function(){
		var wrapper = document.createElement("div");
		wrapper.innerHTML = this.dataFile
			if(this.dataFile){
				switch(wrapper.innerHTML) {
					case "Right":
					this.sendNotification("PAGE_INCREMENT");
						break;
					case "Left" :
					this.sendNotification("PAGE_DECREMENT");
						break;
					default:
					Log.log(`key : ${wrapper.innerHTML} pressed but not assigned`);
				}
				this.sendSocketNotification("Clear_key")
			}
			return wrapper;
	},

});
</code></pre>
<pre><code>const NodeHelper = require("node_helper");
const fs= require("fs");

module.exports = NodeHelper.create({
//here comes the part of the nodehelper after the 3 dots as posted above

	socketNotificationReceived: function(notification, payload) {
		if(notification === "START"){
			this.config = payload;
			this.readData();
    			setInterval(() =&gt; {
        			this.readData();
    			}, this.config.updateInterval);
		}
		if(notification === "Clear_key")
		{
			fs.open('Key_pres.txt', 'r+', function(err, fd) {
				if (err) {
				   return console.error(err);
				}
				fs.ftruncate(fd, function(err){
					if (err){
					   console.log(err);
					}
					console.log("supose to trucate");
				})
			});
	}
	},

	readData: function(){
		fs.readFile("Key_pres.txt", "utf8", (err, data) =&gt; {
			if (err) throw err;
		   this.sendSocketNotification("KEY_P", data);
   })		
	}
});
</code></pre>
<p dir="auto">i have no warning of no declare class or something like that on VS</p>
<p dir="auto">sorry but i beginner with organisation of MM</p>
<p dir="auto">thanks for your rapidity :)</p>
]]></description><link>https://forum.magicmirror.builders/post/43511</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/43511</guid><dc:creator><![CDATA[jchenaud]]></dc:creator><pubDate>Fri, 17 Aug 2018 12:04:10 GMT</pubDate></item><item><title><![CDATA[Reply to error loop on Fri, 17 Aug 2018 11:43:08 GMT]]></title><description><![CDATA[<p dir="auto">Well, the error information are pretty clear, you just need to look at your code to come to a conclusion. Without seeing the code, we can’t know anything about why these errors occur.</p>
<p dir="auto">1st says there’s no element by the class name you’re searching for. Either it’s not there or you’re looking in the wrong place.</p>
<p dir="auto">2nd  says you’re trying to append something that is not an element. You can’t append a string, for example.</p>
<p dir="auto">For example, that’s a string and won’t work:</p>
<pre><code>let parent = document.getElementById("parent");
let element = "&lt;div&gt;lorem ipsum&lt;/div&gt;";
parent.appendChild(element);
</code></pre>
<p dir="auto">This will work:</p>
<pre><code>let parent = document.getElementById("parent");
let element = document.createElement("div");
element.innerHTML = "lorem ipsum";
parent.appendChild(element);
</code></pre>
]]></description><link>https://forum.magicmirror.builders/post/43510</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/43510</guid><dc:creator><![CDATA[doubleT]]></dc:creator><pubDate>Fri, 17 Aug 2018 11:43:08 GMT</pubDate></item></channel></rss>