Skip to content

问题探讨关于ActionPanel.action #43

@uraincay

Description

@uraincay

有没有可能继承ER的promise风格,actionPanel在render之后有一个actionPromise属性,方便用户可以用promise风格去把异步过程串联下去。毕竟用callback的方式还是很不方便的。
现在actionPanel在render之后,action type取决于action初始化时机,开始是一个Promise,之后又变成了Action.

// 现在只能这么写
var actionPanel = ui.create('ActionPanel', options);
actionPanel.render();
var actionPromise = actionPanel.action;
actionPanel.on('actionloaded', function(){
    var actualAction  = actionPanel.action;
    // do something else...
});

// 期待这种风格
actionPanel.action.then(function(actualAction){
    // do something else...
})

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