Closed amorey closed 5 years ago
This PR adds Promise support via a returnPromise argument:
returnPromise
var prom = loadjs(['/path/to/file1.js', '/path/to/file2.js'], {returnPromise: true}); prom.then( function() { /* fulfilled */}, function(pathsNotFound) { /* rejected */ } );
It is backwards compatible and supports success/error callbacks and bundle load events simultaneously:
var prom = loadjs(['/path/to/file1.js', '/path/to/file2.js'], 'bundle1', { success: function() { /* success */ }, error: function(pathsNotFound) { /* error */ }, returnPromise: true }); prom.then( function() { /* success */}, function(pathsNotFound) { /* error */ } ); loadjs.ready('bundle1', function() { /* success */ });
This PR adds Promise support via a
returnPromise
argument:It is backwards compatible and supports success/error callbacks and bundle load events simultaneously: