• TiQuery


    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({
         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.

      

      

    作者:清风送明月
    出处:http://www.cnblogs.com/csu8263/
    另一博客:http://blog.chinaunix.net/uid/20510751.html
    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

  • 相关阅读:
    一周好文(15)
    一周好文(13)
    宏定义中的 "#" 和 "##"
    一周好文(14)
    CCRenderTexture崩溃问题分析
    C++反射机制的实现(转)
    一周好文(16)
    opengl on mac
    uthash: a hash table for C strcutures
    CC3LineNode线条变色的问题
  • 原文地址:https://www.cnblogs.com/csu8263/p/3830658.html
Copyright © 2020-2023  润新知