home *** CD-ROM | disk | FTP | other *** search
/ PC World 2005 December / PCWorld_2005-12_cd.bin / komunikace / netscape / nsb-install-8-0.exe / components / nsJSAimKeywords.js < prev    next >
Text File  |  2005-09-26  |  2KB  |  57 lines

  1. /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
  2. /*
  3.  * Probably need some copyright here! 
  4.  */
  5.  
  6.  
  7. function nsJSAimKeywords() {
  8.     this.keywords = new Array(0);
  9.  
  10.     this.AddKeyword = function(keyword) {
  11.         var size = this.keywords.length; 
  12.         this.keywords[size] = keyword;
  13.     }
  14. }
  15.  
  16. var module = {
  17.     registerSelf: function (compMgr, fileSpec, location, type) {
  18.       compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentManagerObsolete);
  19.         compMgr.registerComponentWithType(this.myCID,
  20.                                           "nsJSAimKeywords",
  21.                                           "@netscape.com/js/aim/keywords;1",
  22.                                           fileSpec, location, true, true, 
  23.                                           type);
  24.     },
  25.  
  26.     getClassObject: function (compMgr, cid, iid) {
  27.         if (!cid.equals(this.myCID))
  28.             throw Components.results.NS_ERROR_NO_INTERFACE;
  29.         
  30.         if (!iid.equals(Components.interfaces.nsIFactory))
  31.             throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
  32.  
  33.         return this.myFactory;
  34.     },
  35.  
  36.     canUnload: function () {
  37.     },
  38.     
  39.     myCID: Components.ID("{95A3F53C-C85F-11d3-B9FF-0010833594E9}"),
  40.     
  41.     myFactory: {
  42.         createInstance: function (outer, iid) {
  43.             if (outer != null)
  44.                 throw Components.results.NS_ERROR_NO_AGGREGATION;
  45.             
  46.             if (!(iid.equals(Components.interfaces.nsIAimKeywords) ||
  47.                   iid.equals(Components.interfaces.nsISupports))) {
  48.                 throw Components.results.NS_ERROR_INVALID_ARG;
  49.             }
  50.  
  51.             return new nsJSAimKeywords();
  52.         }
  53.     }
  54. };
  55.  
  56. function NSGetModule(compMgr, fileSpec) { return module; }
  57.