From 010cd54018c3079b240cc3c679c7378482452e42 Mon Sep 17 00:00:00 2001 From: theia Date: Fri, 3 Feb 2023 15:45:30 -0500 Subject: made GraffitiArray work even after second-level functions + like button to demo --- README.md | 2 +- demo/components/chat.js | 17 ++++---- demo/components/like-button.js | 36 ++++++++++++++++ demo/index.html | 13 +++--- graffiti.js | 4 +- src/array.js | 94 +++++++++++++++++++++--------------------- 6 files changed, 101 insertions(+), 65 deletions(-) create mode 100644 demo/components/like-button.js diff --git a/README.md b/README.md index 199b871..05412b9 100644 --- a/README.md +++ b/README.md @@ -2,4 +2,4 @@ This library enables any webpage to interface with the [Graffiti server](https://github.com/graffiti-garden/graffiti-server). It also includes a plugin that extends it to operate with the [Vue.js framework](https://vuejs.org/). -Check out the live [demo](https://graffiti.garden/graffiti-js/demo) of the library and plugin in action. The demo's source code is in the `/demo` folder. +Check out the live [demo](https://graffiti.garden/graffiti-js/demo) of the library and plugin in action. The demo's source code is in the [`/demo`](https://github.com/graffiti-garden/graffiti-js/tree/main/demo) folder. diff --git a/demo/components/chat.js b/demo/components/chat.js index 86d8fe7..08b478b 100644 --- a/demo/components/chat.js +++ b/demo/components/chat.js @@ -1,13 +1,13 @@ import { Name } from './name.js' +import LikeButton from './like-button.js' export default { - components: { Name }, - - props: ['tags'], + components: { Name, LikeButton }, data: ()=> ({ - message: '' + message: '', + channel: 'demo' }), methods: { @@ -25,20 +25,23 @@ export default { this.$graffitiUpdate({ message: this.message, timestamp: Date.now(), - _tags: this.tags + _tags: [this.channel] }) this.message = '' } }, template: ` - + Chat Channel: + +