网站综合信息 nomospace.github.com
    • 标题:
    • 挪墨的空间 
    • 关键字:
    •  
    • 描述:
    •  
    • 域名信息
    •   
    • 服务器空间
    • IP:199.27.79.133 同IP网站21个 详情
      地址:美国 加利福尼亚州洛杉矶Wikia
    • 备案信息
    • 备案号: 
    网站收录SEO数据
    • 搜索引擎
    • 收录量
    • 反向链接
    • 其他
    • Google
    • 1  
    • 0  
    • pr:1  
    • 雅虎
    • 0  
    •  
    •  
    • 搜搜
    • 0  
    •  
    •  
    • 搜狗
    • 0  
    •  
    • 评级:1/10  
    • 360搜索
    • 0  
    •  
    •  
    域名流量Alexa排名
    •  
    • 一周平均
    • 一个月平均
    • 三个月平均
    • Alexa全球排名
    • 56  
    • 平均日IP
    • 日总PV
    • 人均PV(PV/IP比例)
    • 反向链接
    • dmoz目录收录
    • -  
    • 流量走势图
    域名注册Whois信息

    github.com


    获取时间: 2016年10月25日 02:46:37
    GITHUB.COM.KHALEDELANSARI.COM
    GITHUB.COM

    To single out one record, look it up with "xxx", where xxx is one of the
    records displayed above. If the records are the same, look them up
    with "=xxx" to receive a full display for each record.

    >>> Last update of whois database: Mon, 2016-Oct-24 18:50:41 GMT <<<

    For more information on Whois status codes, please visit https://icann.org/epp
    其他后缀域名
    • 顶级域名
    • 相关信息
    网站首页快照(纯文字版)
    抓取时间:2014年10月19日 22:05:58
    网址:http://nomospace.github.com/
    标题:挪墨的空间
    关键字:
    描述:
    主体:
    nomospace挪墨的空间一种灵活的回调参数设计 [翻译]2012-09-11 posted in [javascript]本文地址:http://nomospace.github.com/posts/flexible-callback-arguments.html原文地址:http://caolanmcmahon.com/posts/flexible_callback_arguments/原文作者:Caolan McMahon在设计 Nimble 时有个需求,需要合并 Underscore.js 与 Async 库的函数,使某些函数可以同步执行,同时也要支持异步执行。当然,为每个函数增加一个可选的回调函数很容易,困难的是修改函数迭代器 (iterator)。如下代码是一个同步函数:_.map([1,2,3], function (value) { ... });_.map([1,2,3], function (value, index) { ... });_.map([1,2,3], function (value, index, arr) { ... });在此你可以指定所有参数,也可以只指定你需要的几个。然而在一个异步的循环中,我们需要传递一个回调函数。在 node.js 中通常最后一个参数是回调函数。所以问题来了,我们无法忽略中间的参数,因为此时总是需要最后一个参数(即回调函数):_.map([1,2,3], function (value, index, arr, callback) { ... });代码非常冗长,arr 和 index 参数大多数时候不会被用到。鉴于此,最初 Async 库的 map 函数是这么实现的:async.map([1,2,3], function (value, callback) { ... });虽省略了一些繁杂的编码,但令人郁闷的是其他参数也无法使用了,也就是说 async api 与其他 synchronous api 的差异会更大。对此我的解决方案是在迭代访问参数时进行检查 (inspect the iterator's arity)。这个术语不是很好理解,直接看代码吧:var fn = f  unction (one, two, three) { ... };// fn.length == 3var fn = function (one) { ... };// fn.length == 1这段代码能在各个浏览器下正常运行,并允许修改我们传入迭代器 (iterator) 的参数,首先定义一组参数,然后删除未被 async 迭代器 (iterator) 使用的元素,并在最后插入一个回调函数:var test = function (iterator) {// the full list of available argumentsvar args = ['value', 'index', 'arr'];// remove the unused argumentsargs = args.slice(0, iterator.length - 1);// add the callback to the endargs.push('callback');// run the iterator with the new argumentsreturn iterator.apply(this, args);};console.log('Example one:');test(function (value, index, arr, callback) {console.log(value);console.log(index);console.log(arr);console.log(callback);});console.log('Example two:');test(function (value, callback) {console.log(value);console.log(callback);});执行结果如下:Example one:valueindexarrcallbackExample two:valuecallback如上所示,执行结果已经和我们的预期保持一致了。如果不使用迭代而使用普通的 arguments 来访问:test(function () {console.log(arguments[0]);console.log(arguments[1]);console.log(arguments[2]);console.log(arguments[3]);});输出结果是这样的:valueindexcallbackundefined这并不是我们所预期的,那好,稍微重构一下 test 函数:var test = function (iterator) {// the full list of available argumentsvar args = ['value', 'index', 'arr'];if (iterator.length) {// remove the unused argumentsargs = args.slice(0, iterator.length - 1);}// add the callback to the endargs.push('callback');// run the iterator with the new argumentsreturn iterator.apply(this, args);
    };
    输出结果:
    value
    index
    arr
    callback
    至此,大功告成。如果你还想进一步实践,check out Nimble 就可以了。如果遇到任何潜在问题,请随时提 issue。
    r.js 配置文件 example.build.js 不完整注释
    2012-08-10 posted in [node]
    Watermark.js for NodeJS
    2011-06-22 posted in [node]
    关注 CSS Lint
    2011-06-16 posted in [css]
    也谈谈Javascript中的几个"怪异"特性
    2011-06-11 posted in [javascript]
    node.js 下的短网址还原
    2011-06-10 posted in [node]
    html5 文件拖放的一个简单实例
    2011-06-09 posted in [html5]
    也说说 yupoo 的页面
    2011-06-06 posted in [frontend]
    浅析 kangax 提出的 Javascript quiz
    2011-05-10 posted in [javascript]
    My Simple & Stupid Match Game v0.2
    2011-05-02 posted in [javascript]
    JavaScript 中的作用域与变量声明提升 [翻译]
    2011-04-11 posted in [javascript]
    弱小版 ImageLazy

    © 2010 - 2020 网站综合信息查询 同IP网站查询 相关类似网站查询 网站备案查询网站地图 最新查询 最近更新 优秀网站 热门网站 全部网站 同IP查询 备案查询

    2024-10-23 00:40, Process in 0.0083 second.