+
Skip to content

Return promise if no callback specified #191

Closed
@reportbase

Description

@reportbase

Is there a way to download multiple files, using promises.

Instead of this:
repos.contents("master", /path/to/a.json, function(error, result){})
repos.contents("master", /path/to/b.json, function(error, result){})
repos.contents("master", /path/to/c.json, function(error, result){})

How about doing this instead:
var a = make_promise("GET", "json", "/path/to/a.json");
var b = make_promise("GET", "json", "/path/to/b.json");
var c = make_promise("GET", "json", "/path/to/c.json");

Promise.all([a,b,c])
.then(function(response)
{

},
function()
{
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载