Created
February 3, 2015 07:45
-
-
Save mridgway/5abc46a3c76214e8470c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var bluebird = require('bluebird'); | |
module.exports = function promisifyPlugin(options) { | |
options = options || {}; | |
/** | |
* @class PromisifyPlugin | |
*/ | |
return { | |
name: 'PromisifyPlugin', | |
/** | |
* Called to plug the FluxContext | |
* @method plugContext | |
* @returns {Object} | |
*/ | |
plugContext: function plugContext() { | |
return { | |
/** | |
* Provides full access to the router in the action context | |
* @param {Object} actionContext | |
*/ | |
plugActionContext: function plugActionContext(actionContext) { | |
actionContext.executeAction = bluebird.promisify(actionContext.executeAction); | |
}, | |
/** | |
* Provides access to create paths by name | |
* @param {Object} componentContext | |
*/ | |
plugComponentContext: function plugComponentContext(componentContext) { | |
componentContext.executeAction = bluebird.promisify(componentContext.executeAction); | |
} | |
}; | |
} | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment