javascript - nodejs events is being called multiple times -


I am working on a CMS, which is hosted nodes. Here I have added some hook hooks. >

  mpObj.emit ('MP3 Footer', 'Center & gt; MPTEST plugin was successfully loaded. & Lt; / center & gt;');   

When I handle this event here:

  mpObj.on ("MP: footer", function (str) {console.log ( Str); if (str) {httpResponse.locals.siteFooter + = str;}});   

This is being executed several times in 1 page. Patterns as follows:

  1. If the page loads for the first time, it will be executed once.
  2. If the page completes the second time, then it will be executed twice.
  3. If the page is full of EN, it will be executed annually.

    Please advise.

    I do not know how your CMS works, but I think the listener is registered multiple times Used to be. mpObj.off ("MP: FOOTER"); or try adding the related function to your CMS before mpObj.on () call.

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -