标签:style blog http java color 使用
TiQuery 是一个基于JQuery 的在Titanium上使用的 javascript 库
TiQuery 为TI 提供了很快捷的方法:
// Utilities
$.info(‘My message‘);
$.error(‘my error message‘);
$.include(‘path/to/file.js‘);
$.currentWindow;
// create* methods
var window = $.Window({
src: ‘path/to/file.js‘
});
var view = $.View({
width: 100,
height: 100,
backgroundColor: ‘red‘
});
window.add(view);
事件:
TIQuery 能很方便地增加和触发事件:
$(view).click(function(event) {
// do something
});
$(view).click(); // triggers the click event
// 也可注册定制事件
$.registerEvent(‘myEvent‘);
$(window).myEvent(function() {
// do something
});
HTTP Client
使用TIQuery从HTTP获得数据也是很简单的:
$.get(‘http://www.google.com‘, function(data) {
// do something with text data
});
$.post(‘http://www.example.com‘, {var1: ‘value1‘, var2: ‘value2‘}, function(data) {
// do something with text data
});
$.getJSON(‘http://www.example.com/file.json‘, function(data) {
// do something with json object
});
$.getXML(‘http://www.example.com/file.xml‘, function(data) {
// do something with xml dom object
});
View the wiki for more information.
标签:style blog http java color 使用
原文地址:http://www.cnblogs.com/csu8263/p/3830658.html