@wp-playground/client 0.1.7 → 0.1.9
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 +20 -0
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Playground Client
|
|
2
|
+
|
|
3
|
+
Provides a WordPress Playground client you can bind to a Playground iframe
|
|
4
|
+
to control the embedded WordPress site. Here's how to use it:
|
|
5
|
+
|
|
6
|
+
```ts
|
|
7
|
+
import { connectPlayground } from '@wp-playground/client';
|
|
8
|
+
|
|
9
|
+
const client = await connectPlayground(
|
|
10
|
+
// An iframe pointing to https://playground.wordpress.net/remote.html
|
|
11
|
+
document.getElementById('wp')! as HTMLIFrameElement
|
|
12
|
+
);
|
|
13
|
+
await client.isReady();
|
|
14
|
+
await client.goTo('/wp-admin/');
|
|
15
|
+
|
|
16
|
+
const result = await client.run({
|
|
17
|
+
code: '<?php echo "Hi!"; ',
|
|
18
|
+
});
|
|
19
|
+
console.log(new TextDecoder().decode(result.body));
|
|
20
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wp-playground/client",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"description": "WordPress Playground client",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -29,5 +29,5 @@
|
|
|
29
29
|
"type": "module",
|
|
30
30
|
"main": "index.js",
|
|
31
31
|
"types": "index.d.ts",
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "ac5bf6b09cb425d650bc57eff03eac6417cccd49"
|
|
33
33
|
}
|