npm install pwd-sdkThis is the client side JS of PWD that allows to run terminals and attach them to your site
Here's a minimal example of the SDK usage:
``html`
If you are running Play with Docker locally (which saves resources on our production machines) create the new session with an additional option:
``
pwd.newSession([{selector: '#myTerm'}], {baseUrl: 'http://localhost'});
You can easily test your page with the SDK by running the following from the root directory of this project on Linux or Mac:
``
docker run --name sdktest -v $PWD:/usr/share/nginx/html:ro -d -it -p 8080:80 nginx
and then browse to localhost:8080.
`html`
rel="stylesheet"
href="https://unpkg.com/pwd-sdk@{version}/dist/styles.css"
/>
`jsx
import { useEffect, useState } from "react";
import PWD from "pwd-sdk";
import ReactPWD, { usePWD } from "pwd-sdk/react";
import "pwd-sdk/dist/styles.css";
export default () => {
const pwd = usePWD(new PWD());
return (
Building the SDK
yarn.Clone this repo and run
yarn install && yarn run build`