Adding preferences to an extension

  • Revision slug: Talk:Adding_preferences_to_an_extension
  • Revision title: Adding preferences to an extension
  • Revision id: 116567
  • Created:
  • Creator: VisualFuture
  • Is current revision? No
  • Comment

Revision Content

Why is infoReceived() skipped when refreshInformation() is triggered by changing the "symbol" preference in the options window?

VisualFuture 16:40, 17 March 2008 (PDT)

All references to the preferences should be

 extensions.stockwatcher2.*

rather than

 stockwatcher2.*

as explained in the article's on this site called "Extension Ettiquette".

--{{ mediawiki.internal('User::RtpHarry|RtpHarry', "en") }} 14:39, 31 August 2006 (GMT)


One could use something like this to avoid repeated code in oncommand.

 <popupset id="mainPopupSet">
   <menupopup id="stockmenu" oncommand="var val=event.target.value; if(val) StockWatcher.watchStock(val)">
     <menuitem label="Refresh Now" default="true"
               oncommand="StockWatcher.refreshInformation()"/>
     <menuseparator/>
     <menuitem label="Apple (AAPL)" value="AAPL"/>
     <menuitem label="Google (GOOG)" value="GOOG"/>
     <menuitem label="Microsoft (MSFT)" value="MSFT"/>
     <menuitem label="Yahoo! (YHOO)" value="YHOO"/>
   </menupopup>
 </popupset>

--Nickolay 13:36, 26 April 2006 (PDT)


Oh, and I would use an anonymous wrapper function here, in order to be able to use this in refreshInformation:

window.setInterval(this.refreshInformation, 10*60*1000);

--Nickolay 05:02, 27 April 2006 (PDT)

Revision Source

<p>Why is <code>infoReceived()</code> skipped when <code>refreshInformation()</code> is triggered by changing the "symbol" preference in the options window?
</p><p><a href="User:VisualFuture">VisualFuture</a> 16:40, 17 March 2008 (PDT)
</p><p>All references to the preferences should be
</p>
<pre class="eval"> <code>extensions.stockwatcher2.*</code>
</pre>
<p>rather than
</p>
<pre class="eval"> <code>stockwatcher2.*</code>
</pre>
<p>as explained in the article's on this site called "Extension Ettiquette".
</p><p>--{{ mediawiki.internal('User::RtpHarry|RtpHarry', "en") }} 14:39, 31 August 2006 (GMT)
</p><p><br>
One could use something like this to avoid repeated code in oncommand.
</p>
<pre class="eval"> &lt;popupset id="mainPopupSet"&gt;
   &lt;menupopup id="stockmenu" oncommand="var val=event.target.value; if(val) StockWatcher.watchStock(val)"&gt;
     &lt;menuitem label="Refresh Now" default="true"
               oncommand="StockWatcher.refreshInformation()"/&gt;
     &lt;menuseparator/&gt;
     &lt;menuitem label="Apple (AAPL)" value="AAPL"/&gt;
     &lt;menuitem label="Google (GOOG)" value="GOOG"/&gt;
     &lt;menuitem label="Microsoft (MSFT)" value="MSFT"/&gt;
     &lt;menuitem label="Yahoo! (YHOO)" value="YHOO"/&gt;
   &lt;/menupopup&gt;
 &lt;/popupset&gt;
</pre>
<p>--<a href="User:Nickolay">Nickolay</a> 13:36, 26 April 2006 (PDT)
</p><p><br>
Oh, and I would use an anonymous wrapper function here, in order to be able to use <code>this</code> in <code>refreshInformation</code>:
</p>
<pre class="eval">window.setInterval(this.refreshInformation, 10*60*1000);
</pre>
<p>--<a href="User:Nickolay">Nickolay</a> 05:02, 27 April 2006 (PDT)
</p>
Revert to this revision