Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support template as promise #15

Merged
merged 1 commit into from
Dec 3, 2020

Conversation

thantos
Copy link
Collaborator

@thantos thantos commented Dec 2, 2020

Other single-spa plugins support promises. Making this one consistent. Lifecycle methods already nicely support promises.

singleSpaHtml({
    template: () => fetch(...).then(x => x.text()),
})

Tested this on single-spa core using...

export const mount = [async (props) => {
     const elm = props.domElementGetter && props.domElementGetter(props);

     if(elm) {
         elm.innerHTML = await fetch(...).then(x => x.text());
    }
}]  

Copy link
Member

@joeldenning joeldenning left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this is a sensible change. Could you also document it, too? Here's the file: https://github.com/single-spa/single-spa.js.org/blob/master/website/versioned_docs/version-5.x/ecosystem-html-web-components.md

@joeldenning joeldenning merged commit 5d751f4 into single-spa:master Dec 3, 2020
@joeldenning
Copy link
Member

Released in https://github.com/single-spa/single-spa-html/releases/tag/v1.3.0. I also invited you to have write access to the single-spa-html repo, since you've helped out a couple times with it now. If you have interest in helping maintain it, you can watch the repo and respond to issues/pull requests as they come in. This repo doesn't see a lot of issues or proposed changes, but I'd appreciate your help with it.

thantos added a commit to thantos/single-spa.js.org that referenced this pull request Dec 3, 2020
Reflect support for the single-spa-html template function returning a promise.

single-spa/single-spa-html#15
joeldenning pushed a commit to single-spa/single-spa.js.org that referenced this pull request Dec 4, 2020
Reflect support for the single-spa-html template function returning a promise.

single-spa/single-spa-html#15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants