TAILIEUCHUNG - Creating Applications with Mozilla-Chapter 8. XPCOM- P3

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 . 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 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 throw 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 dump first time registration of Simple JS component n false throw 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 .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã 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.