http://www.agilesharp.com/Services/blog/rss.ashx?UserDomainName=yanyangtian
Using jQuery from an HTML5 Web Worker
jQuery is one of the most useful frameworks out there for web development. And while most of jQuery is very much about working with the browser DOM there is also another side to it that makes doing networking real easy and that is all based around the $.ajax() and related, like the $.getJSON(), functions. Now HTML5 contains a real useful part in Web Workers for doing work that should not block the background thread. And using theXMLHttpRequest for network IO is fine in a Web Worker.
Unfortunately however working with the DOM is not ok in the Web Worker, which makes total sense, but as a result using jQuery, which has lots of DOM related code is not fine in a Web Worker. And that is a shame because using jQuery for just network IO would be much easier that the XMLHttpRequest and totally fine if it would load.
So removing the DOM code from jQuery should solve the problem right?
Enter the jQuery - No DOM Edition
It turns out Konstantin Pozin did just that with the jQuery - No DOM Edition
You can find it here or download a test version here.
Enjoy!
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步