Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7927637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T19:24:59+00:00 2026-06-03T19:24:59+00:00

I am sending a message like this: self.port.emit(nodes_grubed, textNodesValues); And want to react to

  • 0

I am sending a message like this:

self.port.emit("nodes_grubed", textNodesValues);

And want to react to it:

worker.port.on("nodes_grubed", requestRenderedtext);

But it doesn’t work. What should I change? You can try my add-on here.

main.js:

var widgets = require("widget");
var tabs = require("tabs");
var self = require("self");

function requestRenderedtext(textNodesText) {
  console.log('text nodes requesting');
} 

var widget = widgets.Widget({
  id: "mozilla-link",
  label: "Mozilla website",
  contentURL: "http://www.mozilla.org/favicon.ico",
  onClick: 
    function(worker) {
      tabs.activeTab.attach({
        contentScriptFile: self.data.url("process.js")
      });
      worker.on("nodes_grubed",requestRenderedtext);
      worker.port.on("nodes_grubed",requestRenderedtext);
    },
  onAttach:
    function(worker) {
      worker.on("nodes_grubed",requestRenderedtext);
      worker.port.on("nodes_grubed",requestRenderedtext);
    }
});
widget.on("nodes_grubed",requestRenderedtext);
widget.port.on("nodes_grubed",requestRenderedtext);

process.js:

function getTextNodes() {
  var walker = document.createTreeWalker(
    document.body, 
    NodeFilter.SHOW_TEXT, 
    null, 
    false
  );

  var node;
  textNodes = [];
  var textNodesValues=[];
  while(node = walker.nextNode()) {
    if (node.parentNode.tagName!='SCRIPT') {
      textNodesValues.push(node.nodeValue);
      textNodes.push(node)   
    }
  }
  if (textNodesValues.length!=0) {
    console.log('emmiting nodes');
    self.port.emit("nodes_grubed", textNodesValues);
  }
}

getTextNodes();
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T19:25:04+00:00Added an answer on June 3, 2026 at 7:25 pm

    You don’t get the worker as a parameter when your widget is clicked (it doesn’t exist when the click happens) – you create it by calling tabs.activeTab.attach(). You should use the return value of tabs.activeTab.attach(), like this:

      onClick: 
        function() {
          var worker = tabs.activeTab.attach({
            contentScriptFile: self.data.url("process.js")
          });
          worker.port.on("nodes_grubed", requestRenderedtext);
        },
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

As I know the email message sending process looks like this: The message is
I have a tcp socket sending three lines like this out2.println(message1\n); out2.println(message2\n); out2.println(message3\n); and
Is there some way when sending this message to specify that I rather have
This is my code to send mail (test code): //sending mail var message =
I'm sending multipart/mixed content message from JSP to servlets but when I used ServletFileUpload.isMultipartContent(request);
I sending a message with this code below and works: $headers = 'From: Online
In my messaging application, The features I want to provide are: Sending a message
I'm making a little message sending module. It'll handle queuing messages from a request
is there additional header which is presented by openssl before sending the message to
For sending the same message to 100 devices via c2dm, We need to do

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.