Converts RequireJS call to a promise.