https://github.com/robloach/emscripten_clipboard
Use the Clipboard from Emscripten.
https://github.com/robloach/emscripten_clipboard
emscripten single-header
Last synced: 8 months ago
JSON representation
Use the Clipboard from Emscripten.
- Host: GitHub
- URL: https://github.com/robloach/emscripten_clipboard
- Owner: RobLoach
- License: zlib
- Created: 2024-07-06T19:34:40.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2024-07-07T15:36:46.000Z (almost 2 years ago)
- Last Synced: 2024-12-21T09:08:52.396Z (over 1 year ago)
- Topics: emscripten, single-header
- Language: C
- Homepage:
- Size: 5.86 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# emscripten_clipboard
An attempt at allowing Clipboard usage through Emscripten. Due to browser permissions, the user is required to paste directly into the application to get the clipboard contents.
## Example
``` c
#define EMSCRIPTEN_CLIPBOARD_IMPLEMENTATION
#include "emscripten_clipboard.h"
// Create the clipboard, and initialize it.
emscripten_clipboard clipboard;
emscripten_clipboard_init(&clipboard);
// Set the contents of the clipboard.
emscripten_clipboard_set(&clipboard, "Hello, World!");
// Retrieve the contents. This can be iffy, due to browser permissions.
const char* text = emscripten_clipboard_get(&clipboard);
```
## API
``` c
void emscripten_clipboard_init(emscripten_clipboard* clipboard);
const char* emscripten_clipboard_get(emscripten_clipboard* clipboard);
void emscripten_clipboard_set(emscripten_clipboard* clipboard, const char* text);
```
## Dependencies
- Emscripten
## Development
``` bash
npm start
```
## License
[LICENSE](LICENSE)