Wednesday, April 14, 2010

Introducing Yabble!

A few months ago I started working with Node.js, and by extension, CommonJS. Since then I've become fascinated with the goals of CommonJS and wanted to get involved. CommonJS is mostly suited for the server-side environment, but it does not exclude browsers. There are even a number of frameworks/libraries out there using it in the browser space such as SproutCore, Narwhal, and RequireJS. However, these don't really fullfill the need for a simple, barebones CommonJS module loader for the browser. SproutCore and Narwhal are great, and come with a ton of goodies, but oftentimes all of those goodies are not needed. RequireJS fits more closely with my goals, but still doesn't quite fill the niche that I'm after. Enter Yabble.

Yabble is a general purpose browser-side CommonJS module loader. The goals are to be small, flexible and useful. There are numerous places where, when two paths exist, both were made available instead of choosing one.

XHR vs script tags

Many argue that using script tags for dynamic Javascript injection is preferable over XHR. I tend to agree. Script tags are usually easier to debug and support fetching cross-domain. However, in the CommonJS world, that means that the modules need to be wrapped in some boilerplate code (named a Transport). Since no server-side CommonJS module loader requires this wrapping, it is a pretty big disconnect between modules meant for the server-side and those meant for the browser. Ideally, a single module could be supported on both. With XHR and eval(), it is possible to retrieve the raw module code and "wrap" it on-the-fly. It is also harder to debug and doesn't often support cross-domain requests. So, Yabble supports both. The XHR and eval() method is the default one and I envision its use mostly for quick-and-dirty development efforts. The script tag method can always be used if the developer prefers and when the application is deployed to production.

Hand-wrapped vs auto-wrapped modules

It is possible for modules to be automatically wrapped in a Transport through a build process or some other means. However, some argue that hand-wrapping is the best way to go. I tend to disagree, but, there is nothing stopping anyone from hand-wrapping modules with the use of Yabble. For automatically wrapping, a build-time tool is included to analyze modules and wrap them. Another method is to use a server-side script to wrap and serve modules on demand.

Individual file loading vs packaged file loading

This isn't really a debate. In general, individual file loading is used during development and for deployment a single, packaged file is created to reduce the number of requests. Yabble supports multiple modules being defined in a single file without any additional instructions. In addition, file packaging support for the tooling is on the roadmap.


It is my sincere hope that many find this project useful in creating well-structured web applications. The more people jumping on the CommonJS bandwagon, the better.

For more information and to get the code, visit the project page.
To see it running live, visit the unit tests.

41 comments:

  1. 精力剤:http://www.feelkanpo.com/
    威哥王:http://xn--kwrt2jp9z.feelkanpo.com/
    威哥王:http://www.feelkanpo.com/view/415.html
    三體牛鞭:http://www.feelkanpo.com/view/812.html
    勃動力三體牛鞭:http://www.feelkanpo.com/view/812.html
    三体牛鞭:http://www.feelkanpo.com/view/812.html
    三便宝:http://www.feelkanpo.com/view/823.html
    男宝:http://www.feelkanpo.com/view/634.html
    五便宝:http://www.feelkanpo.com/view/797.html
    巨人倍増:http://www.feelkanpo.com/view/427.html
    狼1号:http://www.feelkanpo.com/view/501.html
    狼一号:http://www.feelkanpo.com/view/501.html
    蟻力神:http://www.feelkanpo.com/view/604.html
    蟻力神(第五代):http://www.feelkanpo.com/view/785.html
    新一粒神:http://www.feelkanpo.com/view/821.html
    蔵八宝:http://www.feelkanpo.com/view/820.html
    黒倍王:http://www.feelkanpo.com/view/575.html
    ru486:http://www.feelkanpo.com/view/407.html
    中絶薬RU486:http://www.feelkanpo.com/view/407.html
    縮陰膏:http://www.feelkanpo.com/view/636.html
    天天素:http://www.feelkanpo.com/view/573.html
    V26:http://www.feelkanpo.com/view/566.html
    曲美:http://www.feelkanpo.com/view/847.html
    福源春:http://www.feelkanpo.com/view/798.html
    紅蜘蛛:http://www.feelkanpo.com/view/473.html
    花痴:http://www.feelkanpo.com/view/593.html
    妖姫:http://www.feelkanpo.com/view/851.html
    淫インモラル:http://www.feelkanpo.com/view/849.html
    D10 媚薬:http://www.feelkanpo.com/view/479.html
    D10催情剤:http://www.feelkanpo.com/view/479.html
    絶對高潮:http://www.feelkanpo.com/view/561.html
    精力剤:http://www.feelkanpo.com/energy/default.html
    漢方薬:http://www.feelkanpo.com/kanpou/default.html
    媚薬:http://www.feelkanpo.com/jyosei/default.html
    プロコミルスプレー:http://www.feelkanpo.com/view/732.html
    VigRx:http://www.feelkanpo.com/view/460.html
    韓国痩身一号:http://www.feelkanpo.com/view/491.html
    痩身一号:http://www.feelkanpo.com/view/491.html
    夜夜堅:http://www.feelkanpo.com/view/751.html
    VVK(Wenickman):http://www.feelkanpo.com/view/459.html
    壮天根:http://www.feelkanpo.com/view/431.html
    魔根:http://www.feelkanpo.com/view/806.html

    ReplyDelete
  2. 漢方会社:http://www.kanpocom.com/
    威哥王:http://xn--kwrt2jp9z.kanpocom.com/
    威哥王:http://www.kanpocom.com/Pro/weigewang.html
    巨人倍増:http://www.kanpocom.com/pro/jurenbeiceng.html
    紅蜘蛛:http://www.kanpocom.com/Pro/hong-zhi-zhu.html
    花痴:http://www.kanpocom.com/Pro/huachi.html
    D10催情剤:http://www.kanpocom.com/pro/D10.html
    絶對高潮:http://www.kanpocom.com/Pro/juedui.html
    三便宝:http://www.kanpocom.com/pro/satibo-capsules.html
    三體牛鞭:http://www.kanpocom.com/Pro/stlb.html
    勃動力三體牛鞭:http://www.kanpocom.com/pro/stlb.html
    三体牛鞭:http://www.kanpocom.com/Pro/stlb.html
    蟻力神:http://www.kanpocom.com/pro/yilishen.html
    五便宝:http://www.kanpocom.com/Pro/wodibo-capsules.html
    狼一号:http://www.kanpocom.com/Pro/langyihao.html
    狼1号:http://www.kanpocom.com/Pro/langyihao.html
    RU486:http://www.kanpocom.com/pro/beijing-ru486.html
    消渇丸:http://www.kanpocom.com/Pro/xiaokewan.html
    天天素:http://www.kanpocom.com/pro/tiantiansu.html
    V26:http://www.kanpocom.com/Pro/V26sx.html
    韓国痩身1号:http://www.kanpocom.com/Pro/hgshs.html
    韓国痩身一号:http://www.kanpocom.com/Pro/hgshs.html
    媚薬 販売:http://www.allkanpou.com/
    花痴:http://www.xn--6qs44kv2wxulv8l.com/
    淫インモラル:http://www.allkanpou.com/product/immoral.html
    花痴:http://www.allkanpou.com/product/%E8%8A%B1%E7%97%B4.html
    威哥王:http://www.allkanpou.com/product/%E5%A8%81%E5%93%A5%E7%8E%8B.html
    巨人倍増:http://www.allkanpou.com/product/%E5%B7%A8%E4%BA%BA%E5%80%8D%E5%A2%97.html
    催情丹:http://www.allkanpou.com/product/cuiqingj.html
    媚薬:http://www.allkanpou.com/biyaku/%E5%AA%9A%E8%96%AC.html
    媚薬通販:http://www.allkanpou.com/biyaku/%E5%AA%9A%E8%96%AC.html
    女性媚薬:http://www.allkanpou.com/biyaku/%E5%A5%B3%E6%80%A7%E5%AA%9A%E8%96%AC.html
    媚薬激安:http://www.allkanpou.com/biyaku/%E5%A5%B3%E6%80%A7%E5%AA%9A%E8%96%AC.html
    媚薬カプセル:http://www.allkanpou.com/biyaku/%E5%AA%9A%E8%96%AC%E5%82%AC%E6%B7%AB.html
    巨人倍増:http://www.xn--tckuez55h0fbkxjnoie3j.com/
    妊娠中絶薬:http://www.xn--fiqv0z4mai18ikui.com/
    プロコミルスプレー:http://www.xn--tckm2gc2b7djc5l.com/
    催情薬:http://www.xn--o0q550b.net/
    レビトラ:http://www.xn--fdkva1ej2834bwg0a.com/
    淫インモラル:http://immoral.yahookanpou.com/
    妖姫:http://xn--vvsqh.yahookanpou.com/
    精力剤:http://www.yahookanpou.com/
    d10媚薬:http://www.xn--d10-hl9e441q.com/
    韓国痩身一号:http://www.xn--4gq48lkwcy40cp4z0ql.com/
    蒼蝿粉:http://www.xn--i6zw1ov9b.com/
    催情丹:http://www.xn--riq92di5x.com/
    絶對高潮:http://www.xn--wetw46b3hk0yo36dn8t.com/
    媚薬カプセル:http://www.yahookanpou.com/catalog/60.html
    女性用媚薬:http://www.yahookanpou.com/catalog/60.html
    威哥王:http://www.yahookanpou.com/product/weigwang.html
    巨人倍増:http://www.yahookanpou.com/product/jurenbeizenggouqi.html
    三便宝:http://www.yahookanpou.com/product/sbb.html
    壮根精華素:http://www.yahookanpou.com/product/zgjhs.html
    韓国痩身一号:http://www.yahookanpou.com/product/hgssyhmtx.html
    韓国痩身1号:http://www.yahookanpou.com/product/hgssyhmtx.html

    ReplyDelete
  3. Thanks for the valuable feedback. I think that strategy is sound and can be easily replicable.Great posts. I love this article. We are Beyond Broking, a Perth based boutique Mortgage rates comparison service helping Australian's obtain loans for some of life's biggest purchases.

    ReplyDelete
  4. Be that as it may, on the off chance that you pick a trader loan, installments are computed as a level of Visa deals, and if the deals are developing, the re-installment could be speedier, yet in the event that the entrepreneur encounters some interference or deals drop in the business, the installments will drop with it.
    online cash advance corona

    ReplyDelete
  5. for keeping away from troublesome expenses is: Read the fine print. You may feel that a free financial records implies that everything is without a worry in the world. What's more, for some free financial records that is valid. no service fee tickets

    ReplyDelete
  6. Wonderful written content. Reap the benefits of a lot of wide open, basic plus pertinent job generating opinions taking good care of the many promotions appointed with the ideal sellers in this love. Now follow-up best bathroom remodeling manhattan Take care exclusively for exceptional written content.

    ReplyDelete
  7. This is not the situation when hiring a man with a Van service company. They will plan everything in advance in a very efficient manner preventing your moving day from turning into a moving night.
    transport company Preston

    ReplyDelete
  8. You really make it seem so easy with your presentation but I find this topic to be really something which I think I would never understand. It seems too complicated and extremely broad for me. I’m looking forward for your next post, I’ll try to get the hang of it 카지노사이트

    ReplyDelete
  9. Excellent web site. Lots of useful info here. I am sending it to a few friends ans also sharing in delicious. And naturally, thank you in your effort!| 바카라사이트

    ReplyDelete
  10. 토토사이트 Thanks for sharing your info. I really appreciate your efforts and I will be waiting for your further post thanks once again.

    ReplyDelete
  11. Hi, after reading this awesome post I am as well delighted to share my know-how here with mates...US citizen travel to Turkey. Yes, all visitors from the US must have a valid Turkey visa for US citizens before entering Turkey.

    ReplyDelete
  12. Great post. Thank you The international travelers traveling to Kenya need to check the Kenya visa information online. However, the online visa application offers you the best, fastest online visa services and also can apply for kenya transit visa. Thank you

    ReplyDelete
  13. This is a topic that’s near to my heart… Many thanks! Where are your contact details though? Thanks for sharing! You can apply for an emergency visa to India registration via mobile phone, computer or desk.

    ReplyDelete
  14. A network switch is a device that connects computers together into a local area network (LAN).
    What is a network switch

    ReplyDelete
  15. Zedex Tata is a well-known Tata car dealer in Gurgaon that offers a variety of cars like Tiago, Tigor, Nexon, Safari, Altroz, etc. Book a test drive of your favorite car and bring it home. Easy EMI options available.

    ReplyDelete
  16. 스포츠토토티비
    스포츠토토



    If more people that write articles really concerned themselves with writing great content like you, more readers would be interested in their writings. Thank you for caring about your content.

    ReplyDelete
  17. I was looking for another article by chance and found your article I am writing on this topic, so I think it will help a lot. I leave my blog address below. Please visit once. 온라인경마

    ReplyDelete

  18. You are doing your job very well... I enjoyed everything...Please continue... People have doubts about the cost of Indian visas, they are not aware of it, so you must check about it before applying for a visa. So what are you waiting for, go and check out.

    ReplyDelete
  19. replica bags philippines wholesale company website g9q51f9p21 replica bags los angeles read review f4u94h6e84 good quality replica bags replica ysl bags australia replica bags china replica gucci handbags n5t60s7x16 replica bags supplier

    ReplyDelete
  20. Superb blog article! I'm genuinely impressed by your skill in simplifying complex concepts into easily understandable content. Your writing style keeps me engaged throughout the entire read. The inclusion of real-life instances enriches the content and makes it relatable. Excited to read more from you! Keep up the exceptional work!

    ReplyDelete
  21. Reading your article felt like taking a stroll through a garden of insights. Each word blossomed into thought-provoking ideas, nurturing my curiosity and igniting a spark within. Your ability to weave words into a tapestry of understanding is truly remarkable. It's as if you whispered secrets of wisdom into my ears, leaving me enchanted and enlightened. Thank you for sharing your perspective; it's a treasure trove for the curious mind seeking nourishment.

    ReplyDelete
  22. Reading your post was like embarking on a journey of self-discovery, each word a stepping stone on the path to enlightenment. It felt like peering into the depths of your soul, witnessing the inner workings of a brilliant mind at work. Your ability to distill complex ideas into simple, elegant prose is truly remarkable. Thank you for sharing your wisdom with the world, for inspiring us to question, to wonder, and to grow.

    ReplyDelete
  23. What a fantastic post! Your writing style is both engaging and informative, making it a pleasure to read. I was impressed by the depth of your knowledge on the topic and how effortlessly you conveyed it. It's clear that you're dedicated to providing valuable content to your audience. I'm excited to see what you'll share next.

    ReplyDelete