@crosscopy/clipboard 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -19
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -53,25 +53,6 @@ console.log(clipboard.readTextSync());
|
|
|
53
53
|
}, 10000);
|
|
54
54
|
```
|
|
55
55
|
|
|
56
|
-
### Note
|
|
57
|
-
|
|
58
|
-
This is an important note. If you write some data and read it immediately using the `sync` APIs, you may not be able to get the data.
|
|
59
|
-
It needs a tiny bit of time to process. any code between the two lines should work, such as `console.log()`.
|
|
60
|
-
|
|
61
|
-
Here I use `await sleep(1)` to make it work.
|
|
62
|
-
|
|
63
|
-
```js
|
|
64
|
-
const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms));
|
|
65
|
-
|
|
66
|
-
cb.writeTextSync("abc");
|
|
67
|
-
await sleep(1);
|
|
68
|
-
const text = cb.readTextSync();
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
If this package becomes popular some day and people requires a fix, I will fix it. For now, this implementation is good enough for CrossCopy.
|
|
72
|
-
|
|
73
|
-
I never need to write and read immediately after unless during testing.
|
|
74
|
-
|
|
75
56
|
## Explanation
|
|
76
57
|
|
|
77
58
|
It's achieved using child process + `stdout`.
|
package/package.json
CHANGED