TAILIEUCHUNG - Creating Applications with Mozilla-Chapter 5. Scripting Mozilla- P4

Tham khảo tài liệu 'creating applications with mozilla-chapter 5. scripting mozilla- p4', 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 5. Scripting Mozilla- P4 Figure 5-4. How XPConnect fits into the application model In Mozilla XPConnect is the bridge between JavaScript and XPCOM components. The XPConnect technology wraps natively compiled components with JavaScript objects. XPCOM Mozilla s own cross-platform component technology is the framework on top of which these scriptable components are built. Using JavaScript and XPConnect you can create instances of these components and use their methods and properties as you do any regular JavaScript object as described here. You can access any or all of the functionality in Mozilla in this way. Chapter 8 describes more about the XPConnect technology and how it connects components to the interface. It also describes the components themselves and their interfaces the XPCOM technology and how you can create your own XPCOM components. . Creating XPCOM objects in script Example 5-10 demonstrates the creation and use of an XPCOM component in JavaScript. In this example the script instantiates the filepicker object and then uses it to display a file picker dialog with all of the file filters selected. To run this example add the function to your file and call it from an event handler on the New menu item you added in Example 3-5. Example 5-10. Scriptable component example chooseApp Open file picker and prompt user for application. chooseApp function var nsIFilePicker var fp @ filepicker 1 . createInstance nsIFilePicker chooseAppFilePickerTitle if true Update dialog. th Note the first two lines in the function and the way they work together to create the fp filepicker object. The first line in the function assigns the name of the nsFilepicker .

TỪ KHÓA LIÊN QUAN
Đã 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.