title: How to register handler for SettingsChanged event in Office Web Add-ins
body: <p>I'm trying to use the <strong>Excel.Setting</strong> and <strong>Excel.SettingCollection</strong> objects in the Excel 1.4 requirement set. (Not the old Setting object from the shared Office.js APIs.) I can't get my handler for the <strong>Excel.SettingCollection.onSettingsChanged</strong> event to be registered. Below is my code (TypeScript). I run the <code>createSetting</code> method and I have verified that my setting is being added. Then I run the <code>changeSetting</code> method. There are no errors, but my handler never runs. Can anyone see what's wrong? Adding a second setting and deleting a setting also don't trigger the handler. (Other Excel 1.4 APIs work fine.) </p>
  
  <pre><code>async function createSetting() {
      try {
          await Excel.run(async (context) =&gt; {
              const settings = context.workbook.settings;
              settings.add("NeedsReview", true);
              settings.onSettingsChanged.add(onChangedSetting);
              await context.sync();
          });
      }
      catch (error){
          console.log(error.message);
      }
  }
  </code></pre>
  
  <p>handler:</p>
  
  <pre><code>async function onChangedSetting() {
      try {
          await Excel.run(async (context) =&gt; {
              console.log("handler ran");  // DOES NOT RUN
              await context.sync();
          });
      }
      catch (error) {
          console.log(error.message);
      }
  } 
  </code></pre>
  
  <p>change setting method:</p>
  
  <pre><code>async function changeSetting() {
      try {
          await Excel.run(async (context) =&gt; {
              const settings = context.workbook.settings;
  
              // The settings.add function is also how you change a 
              // setting. There is no Excel.SettingCollection.setItem
              // or Excel.Setting.set method.
              settings.add("NeedsReview", false); // Change value
              await context.sync();
          });
      }
      catch (error) {
          console.log(error.message);
      }
  }
  </code></pre>