distinguishing old+new APIs - Mozilla
This is a discussion on distinguishing old+new APIs - Mozilla ; Hi -
What's the right way to write code that uses both an old and a new API?
I picture something like this:
if (test for old API)
use old
else if (test for new API)
use new
else
assert(false)
...
-
distinguishing old+new APIs
Hi -
What's the right way to write code that uses both an old and a new API?
I picture something like this:
if (test for old API)
use old
else if (test for new API)
use new
else
assert(false)
But I'm not sure what the (tests) should be.
Specifically, I want to distinguish the Tb2 and Tb3 addressbook APIs.
Thanks -
Leni.
=====
Zindus - Google and Zimbra contact sync for Thunderbird
http://www.zindus.com
-
Re: distinguishing old+new APIs
On Thu, 01 May 2008 16:44:27 +1000, mozilla.org@zindus.com wrote:
> What's the right way to write code that uses both an old and a new API?
[....]
> Specifically, I want to distinguish the Tb2 and Tb3 addressbook APIs.
Perhaps something like:
var spellclass = "@mozilla.org/spellchecker/myspell;1";
if ("@mozilla.org/spellchecker/hunspell;1" in Components.classes)
spellclass = "@mozilla.org/spellchecker/hunspell;1";
else if ("@mozilla.org/spellchecker/engine;1" in Components.classes)
spellclass = "@mozilla.org/spellchecker/engine;1";
var spellchecker =
Components.classes[spellclass].createInstance(Components.interfaces.mozISpellChe ckingEngine);
Phil
--
Philip Chee ,
http://flashblock.mozdev.org/ http://xsidebar.mozdev.org
Guard us from the she-wolf and the wolf, and guard us from the thief,
oh Night, and so be good for us to pass.
[ ]I wish I could remember where I parked my hard disk....
* TagZilla 0.066.6