Skip to content

Commit

Permalink
Version 3.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
CapMousse committed Sep 9, 2016
1 parent 2c984c4 commit 4941556
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 9 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +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/).

## [3.0.2] - 2016-09-09
### Fixed
- CSS with script calling multiple time final callback

## [3.0.1] - 2016-09-09
### Fixed
- Mutiple include level not working

## [3.0.0] - 2016-09-07
### Added
- CSS loading
Expand Down
2 changes: 1 addition & 1 deletion include-min.js

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

9 changes: 4 additions & 5 deletions include.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,13 @@
* onModuleLoaded
* @param {String} name name of the module
* @param {Number} index index of the module
* @param {Boolean} isCss
*/
Include.prototype.onModuleLoaded = function (name, index) {
Include.prototype.onModuleLoaded = function (name, index, isCss) {
var self = this;

// Is this script add a waiting module ? If not, that's a "normal" script file
if (index > waitingModules.length) {
if (index > waitingModules.length || isCss) {
scriptCounter--;
modules[name] = modules[name] || scriptCounter;
} else if (waitingModules[0][0] === null) {
Expand Down Expand Up @@ -201,9 +202,7 @@
while (i--) {
if (sheets[i].href.indexOf(href) != -1) {
elem.setAttribute('data-loaded', true);
self.onModuleLoaded(elem.getAttribute('data-module'), elem.getAttribute('data-count'));

self.checkModuleLoaded();
self.onModuleLoaded(elem.getAttribute('data-module'), elem.getAttribute('data-count'), true);
return;
}
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "include.js",
"version": "3.0.1",
"version": "3.0.2",
"description": "**Include.js** is a tiny Javascript loader. It can load normal javascript files but is more efficient with **web modules**.",
"main": "include-min.js",
"dependencies": {},
Expand Down
4 changes: 2 additions & 2 deletions test/include-specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ describe("Include css", function(){
});
});

it("should be able to load css and module", function(done){
it("should be able to load module and css", function(done){
include([
'https://cdnjs.cloudflare.com/ajax/libs/16pixels/0.1.6/16pixels.css',
'data/b.js'
Expand All @@ -109,7 +109,7 @@ describe("Include css", function(){
});
});

it("should be able to load css and script as module", function(done){
it("should be able to load external script ad module and css", function(done){
include([
'https://cdnjs.cloudflare.com/ajax/libs/1140/2.0/1140.css',
['stripe', 'https://js.stripe.com/v2/stripe.js']
Expand Down

0 comments on commit 4941556

Please sign in to comment.