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

Add share target configurations and documentation #109

Open
syonfox opened this issue Jun 13, 2022 · 0 comments
Open

Add share target configurations and documentation #109

syonfox opened this issue Jun 13, 2022 · 0 comments

Comments

@syonfox
Copy link

syonfox commented Jun 13, 2022

I have created a version of this polyfill that creates 2 classes SharePolyfill and ShareTarget this by default acts as a polyfill in addition to providing a default instance sharePolyfill

end users may then add more share targets by creating one and calling
sharePolyfill.registerShareTarget()

docs ShareTarget

if a user would like to disable native sharing they can ether reinitialize like so
shareTarget = newShareTarget({forcePolyfill:true})
alternatively one could simply override the share function
navigator.share = sharePolyfill.share

This is not really necessary though as if you can just use sharePolyfile.share() when needed and then leave navigator.share() fo use the native implementation and only fallback on sharePolyfill.

if you would like to test this implementation you can install it using
npm install git+https://github.com/syonfox/share-api-polyfill.git

<script src="/node_modules/share-api-polyfill/dist/share.js"></script>

navigator.share({url:'https://sharedgoalof.life', title: 'SGOL', text:'SO cool stuff '})

I have also added some default share targets but have yet to migrate every version help with that may be nice
here is a demo https://syonfox.github.io/share-api-polyfill/demo/
note that print still works and is simply disabled

Tested and working "gmail, yahoo, whatsapp, linkedin, telagram, facebook, twitter, get-pocket,

Purpose, I would like some feedback and for some people track down and implement a variety of share Targets.

preferably ones with no api requirement. but if for share targets that require a api we need to finish the default system for ShareTarget

If there is interest I can work towards a pull request let me know what y'all think.

@rsip22 rsip22 changed the title Add share target configureations and documentation Add share target configurations and documentation Oct 1, 2022
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

No branches or pull requests

1 participant