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

Add web-components #36

Merged
merged 14 commits into from
Dec 4, 2023
1 change: 1 addition & 0 deletions .github/CLA.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,4 @@ Example:

- Metal A-wing, @a-wing, 2023/10/16
- tulingcheng, @tulingcheng86, 2023/10/17
- Opacity, @zreren, 2023/11/2
24 changes: 24 additions & 0 deletions webcomponents/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
*.local

# Visual Studio cache directory
.vs/
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
23 changes: 23 additions & 0 deletions webcomponents/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script src="./dist/index.mjs" type="module"></script>
<link rel="stylesheet" href="./dist/style.css" />
rocka marked this conversation as resolved.
Show resolved Hide resolved
<title>JoyRTC Test</title>
<style>
#root {
max-width: 1280px;
margin: 0 auto;
padding: 2rem;
text-align: center;
}
</style>
</head>
<body>
<div id="root">
<joy-rtc style="width: 1024"></joy-rtc>
rocka marked this conversation as resolved.
Show resolved Hide resolved
</div>
</body>
</html>
9 changes: 9 additions & 0 deletions webcomponents/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/// <reference path="./types/components.d.ts" />

import './style/index.css'
import "./model/joy-rtc"





zreren marked this conversation as resolved.
Show resolved Hide resolved
3 changes: 2 additions & 1 deletion webui/src/joy-rtc.ts → webcomponents/model/joy-rtc.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import nipplejs from "nipplejs";

class JoyRtcComponent extends HTMLElement {
export class JoyRtcComponent extends HTMLElement {
private ws: WebSocket | null = null;
private pc: RTCPeerConnection | null = null;
private dc: RTCDataChannel | null = null;
Expand Down Expand Up @@ -302,4 +302,5 @@ class JoyRtcComponent extends HTMLElement {
}

customElements.define("joy-rtc", JoyRtcComponent);

export default JoyRtcComponent;
Loading