title: Error when using chrome.notifications.create "Uncaught TypeError: Cannot read property 'create' of undefined"
body: <p>Hi I get an error when calling chrome.notifications.create from inside a function in the js of a chrome app. Can be used fine from outside a function but when within a function I get the following error: </p>
  
  <blockquote>
    <p>Uncaught TypeError: Cannot read property 'create' of undefined</p>
  </blockquote>
  
  <p>Here is the code:</p>
  
  <pre><code>document.addEventListener('DOMContentLoaded', function () {
  document.getElementById('submit').addEventListener('click', submit);
  });
  function submit() {
    var options = {
      type:"basic",
      title:"nameVal",
      message:"msgVal",
      iconUrl:"icon.png",
    };
    //notification options set
    chrome.notifications.create(options,callback);
    //notification set
  }
  function callback() {
    console.log("Notification succesfull");
    //notification confirmed
  }
  </code></pre>
  
  <p>Thanks, I'm a noob when it comes to js and chrome apps so any help is appreciated :)</p>