将特定于域的javascript编写为jquery插件是一个好主意吗? [英] Is it a good idea to write domain-specific javascript as jquery plugins?

查看:54
本文介绍了将特定于域的javascript编写为jquery插件是一个好主意吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将您的应用程序javascript作为jquery插件编写是个好主意吗?

Is it a good idea to write your application javascript as jquery plugins?

优点:

  • 通过创建通用接口来促进重用

缺点:

  • 不完全是jquery的扩展.

您有什么想法?

推荐答案

到目前为止,我已经为我的应用程序制作了几个jQuery插件,尽管还没有将它们作为开源发布.

I've made several jQuery plugins so far for my applications, although never released them as Open Source yet.

如果它们是可重用的代码(例如,翻转图像,浮动菜单等),我发现它们非常有用.

I find them pretty useful if they are reusable code (such as rollover images, floating menus, etc).

但是对于其他任何特定于项目的功能,我都不会创建jQuery插件,因为这是不必要的开销,并且您不会从中获得很多收益.

But for any other project-specific feature, I wouldn't go into creating a jQuery plugin, since it's an unnecessary overhead and you wouldn't gain much from it.

这篇关于将特定于域的javascript编写为jquery插件是一个好主意吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆