简体   繁体   English

那里有一个通用的JavaScript库吗?

[英]Is there a general purpose JavaScript library out there?

We started a new project and realized that we needed a general purpose javascript library that contains a nice set of string functions, MD5, base64, allows extensions, etc. Also, copying and pasting functions from other libraries doesn't sound very attractive. 我们开始了一个新项目,并意识到我们需要一个通用的javascript库,它包含一组很好的字符串函数,MD5,base64,允许扩展等。另外,从其他库中复制和粘贴函数听起来并不是很有吸引力。

So, I guess the question is which javascript library contains the most general purpose functionality out there? 所以,我想问题是哪个javascript库包含最通用的功能? or maybe there is a good collection of global functions out there we could use/extend. 或者可能有一个很好的全局函数集合,我们可以使用/扩展。 We know DOM manipulation is covered by many AJAX libraries including JQuery. 我们知道许多 AJAX库(包括JQuery)都涵盖了DOM操作。

*Mind you, we could alternatively extend ExtJS, JQuery, etc. Is that what you guys are doing? *请注意,我们可以选择扩展ExtJS,JQuery等。这是你们在做什么的?

Google Closure Library Google Closure Library

It contains (quoted from link): 它包含(引自链接):

a large set of reusable UI widgets and controls, and from lower-level utilities for DOM manipulation, server communication, animation, data structures, unit testing, rich-text editing, and more. 大量可重用的UI小部件和控件,以及用于DOM操作,服务器通信,动画,数据结构,单元测试,富文本编辑等的低级实用程序。

It also contains a nice set of string manipulating methods, in goog.string namespace. 它还包含一组很好的字符串操作方法,在goog.string命名空间中。

Underscore 下划线

Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js Underscore是一个用于JavaScript的实用程序带库,它提供了许多您在Prototype.js中所期望的函数式编程支持。

Underscore is intended to go along with other library, like jQuery or prototype. Underscore旨在与其他库一起使用,例如jQuery或原型。 It's not extensible like jQuery or Google Closure, though. 但它不像jQuery或Google Closure那样可扩展。

*Mind you, we could alternatively extend ExtJS, JQuery, etc. Is that what you guys are doing? *请注意,我们可以选择扩展ExtJS,JQuery等。这是你们在做什么的?

Yes, I do and I think most are. 是的,我这样做,我认为大部分都是。 A lot of what you describe as a "general purpose library" is covered by Frameworks like JQuery, Prototype or Moo. 很多你所描述的“通用库”都被框架所覆盖,如JQuery,Prototype或Moo。 And short of clipping the webmaster's nails, there's a JQuery plugin for everything that's not already in the core. 除了剪裁网站管理员的指甲之外,还有一个JQuery插件,用于尚未包含在内核中的所有内容。

Still, I'm interested to see whether any other "general purpose" libraries come up here. 不过,我很想知道是否有其他“通用”库出现在这里。 There are fields - like string manipulation, as stated in one of the comments to another answer, and advanced date operations - where none of these frameworks is the holy grail AFAIK. 有一些字段 - 比如字符串操作,如另一个答案的评论中所述,以及高级日期操作 - 这些框架都不是圣杯AFAIK。

I use the jQuery library and a bunch of plugins. 我使用jQuery库和一堆插件。 jQuery's plugin directory contains a lot of useful tools. jQuery的插件目录包含许多有用的工具。 There's also jQuery UI, a set of interactive components and effects, which you can use if you don't want to use a more complex library like ExtJS. 还有jQuery UI,一组交互式组件和效果,如果你不想使用像ExtJS这样的更复杂的库,你可以使用它。

Of course every project is different, and you will probably end up writing some helper functions on your own. 当然每个项目都是不同的,你可能最终会自己编写一些辅助函数。

I realize that others are going to say the same, but jQuery truly amazes me every time I learn something new about it. 我意识到其他人会说同样的话,但每次我学习新的东西时, jQuery都会让我感到惊讶。

DOM, CSS, and event manipulation along with easy AJAX, extensibility, and the plethora of existing extensions make jQuery a wonderful tool for web development. DOM,CSS和事件操作以及简单的AJAX,可扩展性和大量现有扩展使jQuery成为Web开发的绝佳工具。

jQuery is incredibly useful for UI manipulation. jQuery对于UI操作非常有用。 However, being open source, it contains some less than optimal code. 但是,作为开源,它包含一些不是最优的代码。 If you start running into performance issues, don't be afraid to delve into the source and see what's going on. 如果您开始遇到性能问题,请不要害怕深入研究源代码并查看正在发生的事情。

I have been using jQuery for some time now and that seems to handle most of the basic operations I need. 我已经使用jQuery一段时间了,这似乎处理了我需要的大多数基本操作。 It has a healthy library of plug-ins and you can always write your own. 它有一个健康的插件库,你可以随时编写自己的插件。 It is a very good lightweight js library and even if it doesn't do all that you need it to you it is a good starting point. 它是一个非常好的轻量级js库,即使它不能完成所有你需要的它,它也是一个很好的起点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM