Đang chuẩn bị liên kết để tải về tài liệu:
Creating Applications with Mozilla-Chapter 8. XPCOM- P3

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

Tham khảo tài liệu 'creating applications with mozilla-chapter 8. xpcom- p3', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Chapter 8. XPCOM- P3 8.2.1.3. Implementing the required XPCOM methods in JavaScript Once the definitions in the nsISimple interface are implemented you need to implement required methods and factories that make this JavaScript implementation class an XPCOM component. Recall that all XPCOM components must implement the nsISupports interface. Example 8-3 shows an implementation of Queryinterface specific to our new component. Queryinterface ensures that the correct interface nsISimple is used by matching the iid with the nsISimple interface that this component implements. If the interface doesn t match then the argument is invalid. In this case the exception Components.results.NS_ERROR_NO_INTERFACE is thrown which maps to the error code number 2147500034 and code execution is stopped. If the interface identifier parameter matches the interface then an instance of the implementation class object SimpleComponent with its interface is returned as a ready-to-use XPCOM component. In XPCOM every component you implement must have a QueryInterface method. Example 8-3. QueryInterface method for nsISimple interface QueryInterface function iid if iid.equals Components.interfaces.nsISimple iid.equals Components.interfaces.nsISupports throw Components.results.NS_ERROR_NO_INTERFACE return this The next requirement is to create a JavaScript object called Module. This module implements the methods needed for autoregistration and component return type objects. var Module firstTime true The Boolean firstTime is a flag used only when the component is initially registered registerSelf function compMgr fileSpec location type if this.firstTime dump first time registration of Simple JS component n this.firstTime false throw Components.results.NS_ERROR_FACTORY_REGISTER_AGAIN The Component Manager can do a lot in the registration process but you have to add some logic for first time registration so the Component Manager has the information it needs. RegisterSelf is called at registration .

crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.