summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortheia2023-02-03 13:09:02 -0500
committertheia2023-02-03 13:09:02 -0500
commit974738cb241b216ad864f129ca2388379c5f0016 (patch)
treeea141c787fb3895bb132e5dde4f34aaa958542b6
parentfc0bafa80509f86af669e98a38cb9da0f97e58eb (diff)
Demo to root
-rw-r--r--demo/components/chat.js (renamed from plugins/vue/demo/components/chat.js)2
-rw-r--r--demo/components/name.js (renamed from plugins/vue/demo/components/name.js)0
-rw-r--r--demo/index.html (renamed from plugins/vue/demo/index.html)0
-rw-r--r--index.html84
4 files changed, 1 insertions, 85 deletions
diff --git a/plugins/vue/demo/components/chat.js b/demo/components/chat.js
index 7453d77..86d8fe7 100644
--- a/plugins/vue/demo/components/chat.js
+++ b/demo/components/chat.js
@@ -35,7 +35,7 @@ export default {
<graffiti-objects :tags="tags" v-slot="{objects}">
<ul v-for="object in messageObjects(objects)">
<li>
- <name :of="object._by"></name>
+ <em><Name :of="object._by"/></em>:
{{ object.message }}
diff --git a/plugins/vue/demo/components/name.js b/demo/components/name.js
index ea44f95..ea44f95 100644
--- a/plugins/vue/demo/components/name.js
+++ b/demo/components/name.js
diff --git a/plugins/vue/demo/index.html b/demo/index.html
index 7a142c1..7a142c1 100644
--- a/plugins/vue/demo/index.html
+++ b/demo/index.html
diff --git a/index.html b/index.html
deleted file mode 100644
index e3c2dc0..0000000
--- a/index.html
+++ /dev/null
@@ -1,84 +0,0 @@
-<!DOCTYPE html>
-<html>
-<body>
- <h1> Graffiti x JS </h1>
-
- <p id="ID"></p>
-
- <h2 id="status"></h2>
-
- <button onclick="Subscribe()">
- Subscribe
- </button>
-
- <button onclick="Unsubscribe()">
- Unsubscribe
- </button>
-
- <button onclick="Update()">
- Update
- </button>
-
- <button onclick="Remove()">
- Remove
- </button>
-
- <button onclick="LogOut()">
- Log Out
- </button>
-
-<script type="module">
- import Graffiti from "./graffiti.js"
-
- // Connect to a local Graffiti instance
- // (see the server README for how to n locally)
- window.graffiti = new Graffiti("http://localhost:5001")
- await graffiti.opened()
-
- // Log in automatically if not already
- // and supply a log out button
- if (!graffiti.myID) graffiti.toggleLogIn()
- window.LogOut = ()=> graffiti.toggleLogIn()
- document.getElementById('ID').innerHTML = `Your Graffiti ID is: ${graffiti.myID}`
-
- const myTag = "asdf"
-
- // Make a display
- async function displayObjects() {
- let display = 'not subscribed'
- try {
- const objects = graffiti.objectsByTags(myTag)
- display = `objects: ${JSON.stringify(objects)}`
- } catch {}
-
- document.getElementById('status').innerHTML = display
- }
-
- // Create an object containing a special string
- window.Subscribe = async function() {
- await graffiti.subscribe(myTag)
- await new Promise(r => setTimeout(r, 1000));
- displayObjects()
- }
-
- window.Unsubscribe = async function() {
- await graffiti.unsubscribe(myTag)
- await new Promise(r => setTimeout(r, 1000));
- displayObjects()
- }
-
- // Create an object containing a special string
- window.Update = async function() {
- await graffiti.update({_tags: [myTag]})
- displayObjects()
- }
-
- // Remove an existing object
- window.Remove = async function() {
- await graffiti.objectsByTags(myTag)[0]._remove()
- displayObjects()
- }
-
-</script>
-</body>
-</html>