1
votes

I can get Bluebird js to work with Aurelia in the most basic Promise scenario: Create a promise and have an alert() happen when resolve() is called.

But when I try to call other promise functions such as .join I get "_Promise.join is not a function". Can anyone provide some insight? Here is a code snippet.

import {bluebird} from '../jspm_packages/bluebird.min.js';

...

activate(){
    test.then(function(){alert('promise returned')};
}

test(){
     return Promise.join(
        new Promise(function(resolve){resolve();}),
        function(){alert('join finished');}
     );
}
2

2 Answers

2
votes

I looked in the source code for bluebird.js and found this:

module.exports = function(Promise) {
....

so I changed the import statement to this:

import {Promise} from '../jspm_packages/bluebird.min';

and the .join function works now.

1
votes

Looks like your Promise is not from bluebird. Do you really have bluebird.min.js in jspm_packages? Anyway try to add it in index.html before system.js like:

...
<script src="jspm_packages/github/petkaantonov/[email protected]/js/browser/bluebird.js"></script>
<script src="jspm_packages/system.js"></script>
...

Also, when you import some script, don't use .js extension, do import $ from './jquery'