Skip to content

Commit ddc707c

Browse files
committed
update to es6 Promise
1 parent 9a59fd1 commit ddc707c

File tree

13 files changed

+80
-80
lines changed

13 files changed

+80
-80
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ before_script:
55
- npm install -g bower
66
- npm install
77
- bower install
8+
- bower install jquery
89
script:
910
- grunt travis
1011
env:

Gruntfile.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ module.exports = function (grunt) {
6262
// Delete files created by the "testBuild" target.
6363
testBuild: [
6464
"tests/functional/jqueryApp/{bower_components,node_modules,build,tmp}",
65-
"tests/jquery.js" // work around grunt-amd-build bug where it puts files outside of tmp/ dir
65+
"tests/jquery.js" // work around grunt-amd-build bug where it puts files outside of tmp/ dir
6666
]
6767
}
6868
});
@@ -76,7 +76,7 @@ module.exports = function (grunt) {
7676

7777

7878
// By default, lint and run all tests.
79-
grunt.registerTask("default", ["jsbeautifier", "lineending", "jshint", "intern:remote"]);
79+
grunt.registerTask("default", ["jsbeautifier", "lineending", "jshint", "test:remote"]);
8080

8181
// Just lint
8282
grunt.registerTask("lint", ["jsbeautifier", "lineending", "jshint"]);
@@ -116,7 +116,16 @@ module.exports = function (grunt) {
116116
opts: {
117117
cwd: appRootDir
118118
}
119-
}, done.bind(null, true));
119+
}, finish);
120+
}
121+
122+
function finish(error, buildResults) {
123+
if (error !== null) {
124+
grunt.log.writeln(buildResults.stdout);
125+
done(error);
126+
return;
127+
}
128+
done(true);
120129
}
121130

122131
grunt.util.spawn({
@@ -158,7 +167,7 @@ module.exports = function (grunt) {
158167
addReporter("console");
159168
}
160169

161-
// First create the test builds. These are referenced from the intern tests.
170+
// First create the test builds. These are referenced from the intern tests.
162171
grunt.task.run("testBuild");
163172

164173
// Then run the intern tests.

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ All contributions require a [Dojo Foundation CLA](http://dojofoundation.org/abou
2424
_Bower_ release installation:
2525

2626
$ bower install requirejs-dplugins
27+
$ bower install jquery (if you are using the jquery plugin)
2728

2829
_Manual_ master installation:
2930

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "0.4.1",
44
"description": "AMD plugins for RequireJS",
55
"dependencies": {
6-
"jquery": ">=2.1",
6+
"lie": ">=2.8",
77
"requirejs": "2.1.x"
88
},
99
"devDependencies": {},

css.js

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030

3131
define([
3232
"./has",
33-
"./jquery!deferred",
33+
"lie/dist/lie",
3434
"module"
35-
], function (has, $, module) {
35+
], function (has, Promise, module) {
3636
"use strict";
3737

3838
has.add("event-link-onload-api", function (global) {
@@ -49,30 +49,30 @@ define([
4949
* @private
5050
*/
5151
var listenOnLoad = function (link) {
52-
var def = new $.Deferred(),
53-
loadHandler = has("event-link-onload-api") ?
54-
function () {
55-
// We're using "readystatechange" because IE happily support both
56-
link.onreadystatechange = link.onload = function () {
57-
if (!link.readyState || link.readyState === "complete") {
58-
link.onreadystatechange = link.onload = null;
59-
def.resolve();
60-
}
61-
};
62-
} :
63-
function () {
64-
// watches a stylesheet for loading signs.
65-
var sheet = link.sheet || link.styleSheet,
66-
styleSheets = document.styleSheets;
67-
if (sheet && Array.prototype.lastIndexOf.call(styleSheets, sheet) !== -1) {
68-
def.resolve();
69-
} else {
70-
setTimeout(loadHandler, 25);
52+
var loadHandler = has("event-link-onload-api") ?
53+
function (resolve) {
54+
// We're using "readystatechange" because IE happily support both
55+
link.onreadystatechange = link.onload = function () {
56+
if (!link.readyState || link.readyState === "complete") {
57+
link.onreadystatechange = link.onload = null;
58+
resolve();
7159
}
7260
};
61+
} :
62+
function (resolve) {
63+
// watches a stylesheet for loading signs.
64+
var sheet = link.sheet || link.styleSheet,
65+
styleSheets = document.styleSheets;
66+
if (sheet && Array.prototype.lastIndexOf.call(styleSheets, sheet) !== -1) {
67+
resolve();
68+
} else {
69+
setTimeout(loadHandler, 25, resolve);
70+
}
71+
};
7372

74-
loadHandler();
75-
return def.promise();
73+
return new Promise(function (resolve) {
74+
loadHandler(resolve);
75+
});
7676
};
7777

7878
var loadCss = {

docs/jquery.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ library via a `<script>` tag, in which case it just returns a pointer to the alr
1111

1212
It's useful to avoid loading jQuery twice.
1313

14-
When using this plugin, you can use the provided jquery (installed as a `requirejs-dplugins` bower dependency)
15-
or use your own version, either via `bower install jquery` or via
14+
When using this plugin, you must manually include jquery into your app via `bower install jquery` or via
1615
a script tag (ex: `<script src="https://code.jquery.com/jquery-2.1.1.min.js">`).
1716

1817
## Example

jquery.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ define([], function () {
2323
require.config({
2424
map: {
2525
jquery: {
26-
"jquery/src/selector": "jquery/src/selector-native" // don't pull in sizzle
26+
"jquery/src/selector": "jquery/src/selector-native" // don't pull in sizzle
2727
}
2828
}
2929
});

package.json

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,9 @@
1111
"intern": "2.1.x",
1212
"grunt-lineending": "^0.2.2"
1313
},
14-
"licenses": [
15-
{
16-
"type": "BSD",
17-
"url": "https://github.com/ibm-js/requirejs-dplugins/blob/master/LICENSE"
18-
}
19-
],
14+
"licenses": [{
15+
"type": "BSD",
16+
"url": "https://github.com/ibm-js/requirejs-dplugins/blob/master/LICENSE"
17+
}],
2018
"private": true
2119
}

tests/functional/jqueryApp/Gruntfile.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,13 @@ module.exports = function (grunt) {
1111
var outdir = "./build/";
1212
var tmpdir = "./tmp/";
1313

14-
var common = {
15-
options: { banner: "<%= " + outprop + ".header%>" },
16-
src: "<%= " + outprop + ".modules.abs %>",
17-
dest: outdir + "<%= " + outprop + ".layerPath %>"
18-
};
19-
2014
grunt.initConfig({
2115
amdloader: {
2216
baseUrl: ".",
2317

2418
paths: {
2519
jquery: "bower_components/jquery",
20+
lie: "bower_components/lie",
2621
"requirejs-dplugins": "../../.."
2722
},
2823

tests/functional/jqueryApp/bower.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "0.1.0",
44
"description": "Test application using jquery! plugin",
55
"dependencies": {
6+
"lie": ">=2.8",
67
"jquery": ">=2.1",
78
"requirejs": "2.1.x"
89
}

0 commit comments

Comments
 (0)