Skip to content

Take control over your live stream video by running it yourself. Streaming + chat out of the box.

use only unpkg/preact + htm consistently for all components

Ginger Wongfd68f0e52ff8
diff --git a/doc b/doc
deleted file mode 160000
index 54a0ee1396..0000000000
--- a/doc
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 54a0ee13964c70585c24a9b5869604373faaa926
diff --git a/webroot/index-standalone-chat.html b/webroot/index-standalone-chat.html
index 6d47137d61..ad2a7e483d 100644
--- a/webroot/index-standalone-chat.html
+++ b/webroot/index-standalone-chat.html
@@ -16,7 +16,9 @@
<div id="messages-only"></div>
<script type="module">
- import { render, html } from "https://unpkg.com/htm/preact/index.mjs?module";
+ import { render, h } from 'https://unpkg.com/preact?module';
+ import htm from 'https://unpkg.com/htm?module';
+ const html = htm.bind(h);
import StandaloneChat from './js/app-standalone-chat.js';
(function () {
diff --git a/webroot/index-video-only.html b/webroot/index-video-only.html
index 2596778946..cecd5583cd 100644
--- a/webroot/index-video-only.html
+++ b/webroot/index-video-only.html
@@ -20,7 +20,10 @@
<div id="video-only"></div>
<script type="module">
- import { render, html } from "https://unpkg.com/htm/preact/index.mjs?module";
+ import { h, render } from 'https://unpkg.com/preact?module';
+ import htm from 'https://unpkg.com/htm?module';
+ const html = htm.bind(h);
+
import VideoOnly from './js/app-video-only.js';
(function () {
diff --git a/webroot/index.html b/webroot/index.html
index 380ef490c0..35af8ff070 100644
--- a/webroot/index.html
+++ b/webroot/index.html
@@ -48,7 +48,9 @@
<div id="app"></div>
<script type="module">
- import { render, html } from "https://unpkg.com/htm/preact/index.mjs?module";
+ import { render, h } from 'https://unpkg.com/preact?module';
+ import htm from 'https://unpkg.com/htm?module';
+ const html = htm.bind(h);
import App from './js/app.js';
(function () {
diff --git a/webroot/js/app-standalone-chat.js b/webroot/js/app-standalone-chat.js
index fed24a3912..a5c4f1cb04 100644
--- a/webroot/js/app-standalone-chat.js
+++ b/webroot/js/app-standalone-chat.js
@@ -1,4 +1,4 @@
-import { h, Component, Fragment } from 'https://unpkg.com/preact?module';
+import { h, Component } from 'https://unpkg.com/preact?module';
import htm from 'https://unpkg.com/htm?module';
const html = htm.bind(h);
diff --git a/webroot/js/components/chat/chat.js b/webroot/js/components/chat/chat.js
index 119f3ea264..4eb1ecc293 100644
--- a/webroot/js/components/chat/chat.js
+++ b/webroot/js/components/chat/chat.js
@@ -1,6 +1,5 @@
import { h, Component } from 'https://unpkg.com/preact?module';
import htm from 'https://unpkg.com/htm?module';
-// Initialize htm with Preact
const html = htm.bind(h);
import Message from './message.js';
diff --git a/webroot/js/components/chat/content-editable.js b/webroot/js/components/chat/content-editable.js
index 08c41cf19a..c51dfd17d9 100644
--- a/webroot/js/components/chat/content-editable.js
+++ b/webroot/js/components/chat/content-editable.js
@@ -6,7 +6,7 @@ and here:
https://stackoverflow.com/questions/22677931/react-js-onchange-event-for-contenteditable/27255103#27255103
*/
-import { Component, createRef, createElement } from 'https://unpkg.com/preact?module';
+import { Component, createRef, h } from 'https://unpkg.com/preact?module';
function replaceCaret(el) {
// Place the caret at the end of the element
@@ -109,7 +109,7 @@ export default class ContentEditable extends Component {
render(props) {
const { html, innerRef } = props;
- return createElement(
+ return h(
'div',
{
...props,
diff --git a/webroot/js/components/chat/message.js b/webroot/js/components/chat/message.js
index b4e10f53f2..ec7cfdff5d 100644
--- a/webroot/js/components/chat/message.js
+++ b/webroot/js/components/chat/message.js
@@ -1,4 +1,6 @@
-import { html, Component } from "https://unpkg.com/htm/preact/index.mjs?module";
+import { h, Component } from 'https://unpkg.com/preact?module';
+import htm from 'https://unpkg.com/htm?module';
+const html = htm.bind(h);
import { messageBubbleColorForString } from '../../utils/user-colors.js';
import { formatMessageText } from '../../utils/chat.js';
diff --git a/webroot/js/components/chat/username.js b/webroot/js/components/chat/username.js
index e5db552850..f18d37c4a8 100644
--- a/webroot/js/components/chat/username.js
+++ b/webroot/js/components/chat/username.js
@@ -1,6 +1,5 @@
import { h, Component, createRef } from 'https://unpkg.com/preact?module';
import htm from 'https://unpkg.com/htm?module';
-// Initialize htm with Preact
const html = htm.bind(h);
import { generateAvatar, setLocalStorage } from '../../utils/helpers.js';
diff --git a/webroot/js/components/social.js b/webroot/js/components/social.js
index 0bdf941026..20d69f1f72 100644
--- a/webroot/js/components/social.js
+++ b/webroot/js/components/social.js
@@ -1,4 +1,6 @@
-import { html } from "https://unpkg.com/htm/preact/index.mjs?module";
+import { h } from 'https://unpkg.com/preact?module';
+import htm from 'https://unpkg.com/htm?module';
+const html = htm.bind(h);
import { SOCIAL_PLATFORMS } from '../utils/social.js';
import { classNames } from '../utils/helpers.js';
diff --git a/webroot/js/utils/chat.js b/webroot/js/utils/chat.js
index b7db2659ca..896c2cc92b 100644
--- a/webroot/js/utils/chat.js
+++ b/webroot/js/utils/chat.js
@@ -1,9 +1,5 @@
import { addNewlines } from './helpers.js';
import {
- KEY_USERNAME,
- KEY_AVATAR,
- KEY_CHAT_DISPLAYED,
- KEY_CHAT_FIRST_MESSAGE_SENT,
CHAT_INITIAL_PLACEHOLDER_TEXT,
CHAT_PLACEHOLDER_TEXT,
CHAT_PLACEHOLDER_OFFLINE,