New web component: <webcare-webshare>
Uses the Web Share API to share a web site, falling back (on desktop usually) to a copy to clipboard workflow.
Blog post: https://www.zachleat.com/web/webcare-webshare/
Demo: https://zachleat.github.io/webcare-webshare/demo.html
Source code: https://github.com/zachleat/webcare-webshare
@ben Thanks Ben!
@zachleat Glad this pattern was useful, thanks for the shout-out: https://github.com/zachleat/webcare-webshare/blob/963e5d2eadf2a54f699e06ee44cb053a28f0188b/webcare-webshare.js#L1.
@tomayac For sure! I’ll add some better links in the README too
@zachleat Just to be sure, I wasn’t fishing for this. Simply was having a happy moment when I studied the source code.
@tomayac Ah, yeah I know—I thought I could do a little better though
@zachleat please help me learn - in what circumstances does globalThis work that window wouldn't (specific to web components) and when would someone use the registry argument to supply their own?
It all seems reasonable, but I just don't know enough about what the extra considerations are and would appreciate your expertise.
@scrwd I think they’re basically the same—it’s just an academic thing compatible with more environments (though I’ll probably only use it in the browser)
@zachleat Thanks for webcare-webshare, great work as usual. I have made a similar component inspired by this and would love to know what you think of my implementation. https://nigelotoole.github.io/share-url/
@nigelotoole looks great! That maintainSize option
@zachleat Thanks so much.