TAILIEUCHUNG - Creating Applications with Mozilla-Chapter 7. Extending the UI with XBL- P3

Tham khảo tài liệu 'creating applications with mozilla-chapter 7. extending the ui with xbl- 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 7. Extending the UI with XBL- P3 Although it is most commonly used just for getting and setting values on the property nothing stops you from putting more code in the properties element that carries out other actions on the binding. One scenario shown in Example 7-3 is if you have a property that holds a search value you can send that text to the Google 1 API and fill another widget in the UI with the results every time the value is updated. 2 Example 7-3. Performing a Google search when setting a property property name searchString setter CDATA var s new SOAPCall var q val if s return Error creating SOAPCall object var soapversion 0 var method doGoogleSearch var object urn GoogleSearch var headers var params new SOAPParameter key new SOAPParameter q q new SOAPParameter start new SOAPParameter maxResults new SOAPParameter filter new SOAPParameter restrict new SOAPParameter safeSearch new SOAPParameter lr new SOAPParameter utf8 ie new SOAPParameter utf8 oe soapversion method object headers params http search beta2 var response if return msg SOAP call error fault At this point you would pass the results back to the UI return setter property The value of the search string is set to the value that has been given to the property var q val. This value is then added to the parameter list SOAPParameter for the SOAP call along with other parameters that are obtained from other properties in the binding . . Notes 1 This example is modified code taken from http mozilla GoogleAPI and is covered by a three-clause BSD license. More on SOAP and the SOAP API in Mozilla can be found at http mozilla source extensions xmlextras docs Soap_Scripts_in_Mozilla. 2 The Google API requires a Google Key .

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.