FLUID-5968: Improve fluid.promise.map to accept functions which return promises

Metadata

Source
FLUID-5968
Type
Improvement
Priority
Major
Status
Closed
Resolution
Fixed
Assignee
Antranig Basman
Reporter
Antranig Basman
Created
2016-09-22T11:35:40.980-0400
Updated
2016-11-22T09:38:12.379-0500
Versions
N/A
Fixed Versions
N/A
Component
  1. Framework

Description

The core utility http://docs.fluidproject.org/infusion/development/PromisesAPI.html#fluid-promise-map-source-func- could be improved a little to also accept functions which return promises rather than plain values. This is getting us dangerously close to providing a full "promises calculus" but it seems like a harmless and cheap enough extension. The use case occurred during https://github.com/GPII/universal/pull/464/files with the following implementation:

var authorizedServicesPromise = fluid.promise();
   promisesSequence.then(function (responses) {
        gpii.oauth2.authServer.resolveAuthorizedServices(authorizedServicesPromise, responses, user);
    });

    return authorizedServicesPromise;

Comments