Object-oriented extensions, syntax sugar and helpful functions for the jQuery Javascript library
Download the production version or the development version.
In your web page:
<script src="jquery.js"></script>
<script src="dist/jquery-extensions.min.js"></script>
<script>
// define some classes
var Person = $.Class.create({
init: function(name) {
this.name = name;
},
toString: function() {
return "Hello, my name is " + this.name;
}
});
var Ninja = $.Class.extend(Person, {
init: function(name) {
this._super(name);
},
toString: function() {
return "... you hear nothing ..."
}
});
// create some instances and call some methods
var bob = new Person("Bob");
var nameless = new Ninja("nameless");
bob.toString(); #=> Hello, my name is bob
nameless.toString(); #=> ... you hear nothing ...
</script>
(Coming soon)
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using grunt.
Also, please don't edit files in the "dist" subdirectory as they are generated via grunt. You'll find source code in the "src" subdirectory!
Requires:
- Grunt 0.3.9
jQuery Extensions is built using grunt.
Once you have Grunt installed, you can build the project by running grunt
. The default grunt task will run JSHint to look for problems, run the Qunit tests, build and minify the library.
Available Grunt targets are:
concat
- Builds the librarymin
- Minimizes the built librarylint
- Runs JSHint to look for coding problems.qunit
- Runs the QUnit tests. You must have PhantomJS installed to be able to run the tests!watch
- Watch JS source files and tests for changes. Lint and tests code when changes are detected.
Note: in Windows, you may need to run grunt as grunt.cmd
. See the FAQ for more Windows-specific information.
- 0.0.1 - Converted to jQuery, ditched ruby for a node.js Grunt build process.
Copyright (c) 2012 Brian Cowdery
Licensed under the MIT, GPL licenses.