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

Browser support? #60

Closed
Richienb opened this issue Mar 12, 2020 · 4 comments · Fixed by #61
Closed

Browser support? #60

Richienb opened this issue Mar 12, 2020 · 4 comments · Fixed by #61

Comments

@Richienb
Copy link
Contributor

We can use document.execCommand or the Async Clipboard API to create a 1:1 implementation for browsers.

See: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Interact_with_the_clipboard

cc @sindresorhus

@sindresorhus
Copy link
Owner

Sure, but only the async APIs can be supported. It should use the Async Clipboard API. Not interested in any fallback for older browsers.

See https://nodejs.org/api/esm.html#esm_conditional_exports on how to add the browser version.

@Richienb
Copy link
Contributor Author

@sindresorhus In that case, how do we handle calls to writeSync and readSync when running in the browser if we want a 1:1 interface?

@sindresorhus
Copy link
Owner

We would just document that those don't work in the browser.

@Richienb
Copy link
Contributor Author

@sindresorhus The latest version of browserify can't seem to recognise the browser field. Do you have an example in another one of your packages?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants