Skip to content

Commit

Permalink
Implemented proper jQuery loading/factory method
Browse files Browse the repository at this point in the history
  • Loading branch information
kasparsz committed Sep 1, 2016
1 parent 7145628 commit 0a5cd4b
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [0.4.0] - 2016-09-01
### Changed
- Implemented proper jQuery loading/factory method

## [0.3.1] - 2016-08-29
### Added
- ```debug``` configuration option [\#1](https://github.com/kasparsz/jquery-app/issues/1)


[0.4.0]: https://github.com/kasparsz/jquery-app/compare/v0.3.1...v0.4.0
[0.3.1]: https://github.com/kasparsz/jquery-app/compare/v0.2.2...v0.3.1
13 changes: 10 additions & 3 deletions dist/jquery-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,15 @@
* Licensed under the MIT License.
*/

(function (global) {
var $ = global.jQuery || window.jQuery;
(function (factory) {
if (typeof define === 'function' && define.amd) {
define(['jquery'], factory);
} else if (typeof exports === 'object') {
factory(require('jquery'));
} else {
factory(jQuery);
}
}(function ($) {
var REGEX_SPLIT = /\s*,\s*/;
var REGEX_NOT_LOWERCASE = /[^a-z]/;
var PROPERTY_NAME = 'jQueryAppData';
Expand Down Expand Up @@ -130,4 +137,4 @@
return this;
};

})(this);
}));
2 changes: 1 addition & 1 deletion dist/jquery-app.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "jquery-app",
"description": "Declarative jQuery plugin initialization on DOM elements",
"version": "0.3.2",
"version": "0.4.0",
"homepage": "https://github.com/kasparsz/jquery-app",
"repository": "kasparsz/jquery-app",
"bugs": {
Expand Down
13 changes: 10 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,15 @@
* Licensed under the MIT License.
*/

(function (global) {
const $ = global.jQuery || window.jQuery;
(function (factory) {
if (typeof define === 'function' && define.amd) {
define(['jquery'], factory);
} else if (typeof exports === 'object') {
factory(require('jquery'));
} else {
factory(jQuery);
}
}(function ($) {
const REGEX_SPLIT = /\s*,\s*/;
const REGEX_NOT_LOWERCASE = /[^a-z]/;
const PROPERTY_NAME = 'jQueryAppData';
Expand Down Expand Up @@ -130,4 +137,4 @@
return this;
};

})(this);
}));

0 comments on commit 0a5cd4b

Please sign in to comment.