klenwell information services : Javascript

Wiki source for Javascript


Show raw source

===== Javascript =====
==== jQuery ====
Use one of the following patterns for jQuery:

=== Module ===
The module is best used for modules where the abstraction is centralized and does not require multiple instantiations (as with a class object).

~- Source: https://learn.jquery.com/code-organization/concepts/#the-module-pattern
~- Example: https://github.com/chapmanu/cascade-assets/blob/development/app/assets/javascripts/omni_nav/omni-nav-v2.js

=== Plugin ===
To build your own classic jQuery plugin that can be used like so: ""<tt>$('div').foo()</tt>""

~- Source: https://github.com/jquery-boilerplate/jquery-boilerplate/blob/master/src/jquery.boilerplate.js
~- Example: TBA

=== Web Widget ===
To build a centralized widget pushed out to multiple sites (e.g. Disqus comment forms).

~- Source: http://alexmarandon.com/articles/web_widget_jquery/
~- Example: TBA