New nsIScriptable interface: Difference between revisions

Jump to navigation Jump to search
Line 136: Line 136:
         // which the returned function will execute when called.
         // which the returned function will execute when called.
         // Generally you pass |this|.
         // Generally you pass |this|.
         nsIScriptable CompileFunction(in nsISupports glob,
         nsIScriptable compileFunction(in nsISupports glob,
                                       in PRUint32 langID,  
                                       in PRUint32 langID,  
                                       in DOMString aCode,  
                                       in DOMString aCode,  
Line 142: Line 142:
      
      
         // Execute arbitrary code.
         // Execute arbitrary code.
         void Exec(PRUint32 langID, in DOMString aCode);
         void execute(PRUint32 langID, in DOMString aCode);
      
      
         // Takes a script-type ID (which is presumably the ID for
         // Takes a script-type ID (which is presumably the ID for
Line 149: Line 149:
         // executing language) and returns an nsIScriptable, which is  
         // executing language) and returns an nsIScriptable, which is  
         // the namespace for the requested language.
         // the namespace for the requested language.
         nsIScriptable GetLanguageGlobal(in PRUint32 aRequestedLanguage, in nsISupports glob);
         nsIScriptable getLanguageGlobal(in PRUint32 aRequestedLanguage, in nsISupports glob);
     };
     };


Line 157: Line 157:
     var s = components.classes["@mozilla.org/scriptobjectfactory"].getService();
     var s = components.classes["@mozilla.org/scriptobjectfactory"].getService();
      
      
     var func = s.CompileFunction(this, lang_id, handler, "event");
     var func = s.compileFunction(this, lang_id, handler, "event");
     // |func| is an nsIScriptable - call it.
     // |func| is an nsIScriptable - call it.
     var returned = func(event)
     var returned = func(event)
Confirmed users, Bureaucrats and Sysops emeriti
419

edits

Navigation menu