title: how do i turn off onCreated event listener in Chrome extension?
body: <p>I have a simple chrome extension that automatically closes new tabs. The goal is for the extension to toggle on/off via clicking the browser icon. I'm able to activate it, however I'm unable to turn it off. Here's what I have so far:</p>
  <pre><code>var enable=false;
  chrome.browserAction.onClicked.addListener(function (tab) {
    enable = enable ? false : true;
    if(enable){
      chrome.tabs.onCreated.addListener(function (tab) {
        chrome.tabs.remove(tab.id);
      });
      chrome.browserAction.setIcon({path: 'on.png'});
    }
    else{
      chrome.browserAction.setIcon({path: 'icon.png'});
      // I'm not sure what to put here
    }
  });
  </code></pre>
  <p>I have 2 different images to represent the on/off state which is working fine, however the listener remains active. I've tried removeListener to no avail. Any help would be much appreciated!</p>