Add AsyncButton component
With the Button
and Icon
classes, need to decide whether AsyncButton
will be it's own component, or just merged into Button
....
If it was merged into Button
the settings could look like:
m(Button, {
async: {
fn: () => Promise.resolve(), // pretend this takes some time
content: m("span", [m(Icon, {type:"save"}), m("span","Click to Save")]),
loadingContent: m("span", "Saving..."),
afterLoadingContent: m("span", "Done!"), // defaults to preloading content
contentResetTimeout: 500ms, // Amount of time to wait until resetting content
}
});
Edited by MrMan