Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Deferred: Backwards-compatible standards interoperability #1996

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 18 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ module.exports = function( grunt ) {
}

var gzip = require( "gzip-js" ),
spawn = require( "child_process" ).spawn,
srcHintOptions = readOptionalJSON( "src/.jshintrc" );

// The concatenated file won't pass onevar
Expand Down Expand Up @@ -55,6 +56,8 @@ module.exports = function( grunt ) {
"sizzle/dist": "sizzle/dist",
"sizzle/LICENSE.txt": "sizzle/LICENSE.txt",

"npo/npo.js": "native-promise-only/npo.js",

"qunit/qunit.js": "qunitjs/qunit/qunit.js",
"qunit/qunit.css": "qunitjs/qunit/qunit.css",
"qunit/LICENSE.txt": "qunitjs/LICENSE.txt",
Expand Down Expand Up @@ -168,12 +171,24 @@ module.exports = function( grunt ) {
});
});

grunt.registerTask( "promises-aplus-tests", function() {
var done = this.async();
spawn( "node", [
"./node_modules/.bin/promises-aplus-tests",
"./promises-aplus-adapter.js"
], {
stdio: "inherit"
}).on( "close", function( code ) {
done( code === 0 );
});
});

// Short list as a high frequency watch task
grunt.registerTask( "dev", [ "build:*:*", "lint" ] );

grunt.registerTask( "test_fast", [ "node_smoke_test" ] );

grunt.registerTask( "test", [ "default", "test_fast" ] );
grunt.registerTask( "test", [ "default", "test_fast", "promises-aplus-tests" ] );

grunt.registerTask( "default", [ "jsonlint", "dev", "uglify", "dist:*", "compare_size" ] );
};
5 changes: 5 additions & 0 deletions external/npo/npo.js

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

4 changes: 2 additions & 2 deletions external/requirejs/require.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/** vim: et:ts=4:sw=4:sts=4
* @license RequireJS 2.1.14 Copyright (c) 2010-2014, The Dojo Foundation All Rights Reserved.
* @license RequireJS 2.1.15 Copyright (c) 2010-2014, The Dojo Foundation All Rights Reserved.
* Available via the MIT or new BSD license.
* see: http://github.com/jrburke/requirejs for details
*/
Expand All @@ -12,7 +12,7 @@ var requirejs, require, define;
(function (global) {
var req, s, head, baseElement, dataMain, src,
interactiveScript, currentlyAddingScript, mainScript, subPath,
version = '2.1.14',
version = '2.1.15',
commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,
cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,
jsSuffixRegExp = /\.js$/,
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,13 @@
"gzip-js": "0.3.2",
"jsdom": "1.5.0",
"load-grunt-tasks": "1.0.0",
"native-promise-only": "0.7.6-a",
"npm": "2.1.12",
"promises-aplus-tests": "2.1.0",
"q": "1.1.2",
"qunitjs": "1.16.0",
"requirejs": "2.1.15",
"sinon": "1.12.2",
"sinon": "1.10.3",
"sizzle": "2.1.1",
"testswarm": "1.1.0"
},
Expand Down
21 changes: 21 additions & 0 deletions promises-aplus-adapter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
"use strict";

require( "jsdom" ).env( "", function (errors, window) {
if (errors) {
console.error(errors);
return;
}
var jQuery = require( "./" )( window );

exports.deferred = function () {
var deferred = jQuery.Deferred();

return {
get promise() {
return deferred.promise();
},
resolve: deferred.resolve.bind(deferred),
reject: deferred.reject.bind(deferred)
};
};
});
Loading