home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / mozil06.zip / bin / chrome / toolkit.jar / content / global / nsJSComponentManager.js < prev    next >
Text File  |  2001-02-14  |  2KB  |  79 lines

  1. /* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public
  4.  * License Version 1.1 (the "License"); you may not use this file
  5.  * except in compliance with the License. You may obtain a copy of
  6.  * the License at http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the License is distributed on an "AS
  9.  * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
  10.  * implied. See the License for the specific language governing
  11.  * rights and limitations under the License.
  12.  *
  13.  * The Original Code is mozilla.org code.
  14.  *
  15.  * The Initial Developer of the Original Code is Netscape
  16.  * Communications Corporation.  Portions created by Netscape are
  17.  * Copyright (C) 1998 Netscape Communications Corporation. All
  18.  * Rights Reserved.
  19.  *
  20.  * Original Author:
  21.  *   Ben Matthew Goodger <ben@netscape.com>
  22.  *
  23.  * Contributor(s): 
  24.  */
  25.  
  26. var nsJSComponentManager = {
  27.   createInstance: function (aContractID, aIID)
  28.     {
  29.       try
  30.         {
  31.           var iid = Components.interfaces[aIID];
  32.           return Components.classes[aContractID].createInstance(iid);
  33.         }
  34.       catch(e)
  35.         {
  36.         }
  37.         return null;
  38.     },
  39.  
  40.   createInstanceByID: function (aID, aIID)
  41.     {
  42.       try
  43.         {
  44.           var iid = Components.interfaces[aIID];
  45.           return Components.classesByID[aID].createInstance(iid);
  46.         }
  47.       catch(e)
  48.         {
  49.         }
  50.         return null;
  51.     },
  52.         
  53.   getService: function (aContractID, aIID)
  54.     {
  55.       try
  56.         {
  57.           var iid = Components.interfaces[aIID];
  58.           return Components.classes[aContractID].getService(iid);
  59.         }
  60.       catch(e)
  61.         {
  62.         }
  63.         return null;
  64.     },
  65.   
  66.   getServiceByID: function (aID, aIID)  
  67.     {
  68.       try
  69.         {
  70.           var iid = Components.interfaces[aIID];
  71.           return Components.classesByID[aID].getService(iid);
  72.         }
  73.       catch(e)
  74.         {
  75.         }
  76.         return null;
  77.     }
  78. };
  79.