JavaScript Firefox Addon Attach event for PageMod is not emitting events

I am unable to communicate between my addon and my attach script. The attach event for PageMod works however it doesn't emit my getElements event to my list-getter. How do you use the port.emit method properly? Thanks!

index.js (addon)

var pageMod = require('sdk/page-mod');
var data = require("sdk/self").data;

pageMod.PageMod({
  include: "*.workflowy.com",
  contentScriptFile: [data.url("jquery-1.11.3.min.js"), data.url("list-getter.js")], 
  onAttach: function(worker) {

    // For some reasong the worker doesn't emit?
    worker.port.emit("getElements");

    worker.port.on("gotElements", function(times) {
      function printValues(el) {
        console.log(el);
      }
      times.forEach(printValues);
    });
  }
});

list-getter.js (contentScriptFile)

self.port.on("getElements", function() {
  var timeRegex = /\bam|pm/g
  var openLists = $('.project.open').find('.content');
  var times = []
  for (var i = 0; i < openLists.length; i++) {
    if (openLists[i].innerHTML.match(timeRegex)) {
      times.push(openLists[i].innerHTML)
    }
  }
  self.port.emit("gotElements", times);
});
Answer:1

I'm trying to programmatically create a pie chart in hopes of turning it into a React Component to reuse. Basically I need a pie chart that is clickable and each slice expands into a whole pie when ...

I'm trying to programmatically create a pie chart in hopes of turning it into a React Component to reuse. Basically I need a pie chart that is clickable and each slice expands into a whole pie when ...

Currently I am working on Learning React and Redux. I have found a boilerplate, and I am working on looking through all of the example code. My problem is I don't completely understand what a lot of ...

Currently I am working on Learning React and Redux. I have found a boilerplate, and I am working on looking through all of the example code. My problem is I don't completely understand what a lot of ...

I have my custom script for map into my webpage,but it no have point mark for exactly ubication: <script> /* Map */ (function () { "use strict"; if (document.getElementById("map")) { ...

I have my custom script for map into my webpage,but it no have point mark for exactly ubication: <script> /* Map */ (function () { "use strict"; if (document.getElementById("map")) { ...

  1. mark point google maps

I have a link with an hover effect. When you hover it, the text become red and underlined. When you click it, the text stay red and underlined. My problem is that once you clicked on the link, the ...

I have a link with an hover effect. When you hover it, the text become red and underlined. When you click it, the text stay red and underlined. My problem is that once you clicked on the link, the ...

  1. hover click event jquery
  2. mouse hover click jquery
  3. hover after click jquery
  4. hover instead of click jquery
  5. remove hover on click jquery
  6. change hover to click jquery
  7. combine hover and click jquery
  8. jquery hover click conflict
  9. jquery hover click mobile
  10. hover and click function jquery
  11. convert hover to click jquery
  12. jquery hover click toggle
  13. disable hover after click jquery