Skip to content

Add share target configurations and documentation #109

@syonfox

Description

@syonfox

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.

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