Pārlūkot izejas kodu

setting up messageFactory

tags/0.0.1^2
K Rob 3 gadus atpakaļ
vecāks
revīzija
5e90c7f2c2

+ 14
- 0
frontend/src/services/chat.service.js Parādīt failu

15
 }
15
 }
16
 
16
 
17
 /**
17
 /**
18
+ * Message factory
19
+ * simple message object creator
20
+ * to notify the frontend ui of a new message
21
+ */
22
+const messageFactory = {
23
+    success: () => console.log('success message for sent message'),
24
+    received: (e) => console.log('received message for received message', e),
25
+    error: () => console.log('error message for failed message'),
26
+}
27
+
28
+/**
29
+ * 
30
+ * 
18
  * Breaking out as much pubnub specific flavor
31
  * Breaking out as much pubnub specific flavor
19
  */
32
  */
20
 const setupPubnub = async uuid => {
33
 const setupPubnub = async uuid => {
129
         this.subscriptions = [MAIN_CHANNEL]
142
         this.subscriptions = [MAIN_CHANNEL]
130
         console.warn('chatter stop no implemented')
143
         console.warn('chatter stop no implemented')
131
     }
144
     }
145
+
132
 }
146
 }
133
 
147
 
134
 export { Chatter }
148
 export { Chatter }

+ 16
- 1
frontend/src/views/HomeView.vue Parādīt failu

12
     
12
     
13
     p(v-else-if="matches.length===0") No matches.
13
     p(v-else-if="matches.length===0") No matches.
14
     p(v-else) Loading...
14
     p(v-else) Loading...
15
-
15
+    <w-button @click="notify" bg-color="success"> notify </w-button>
16
+    
16
 </template>
17
 </template>
17
 
18
 
18
 <script>
19
 <script>
20
+    import 'wave-ui/dist/wave-ui.css'
19
 import ProfileCardList from '../components/ProfileCardList.vue'
21
 import ProfileCardList from '../components/ProfileCardList.vue'
20
 
22
 
21
 import { Card } from '../entities'
23
 import { Card } from '../entities'
69
             }
71
             }
70
             this.loading = false
72
             this.loading = false
71
         },
73
         },
74
+        notify() {
75
+            this.$waveui.notify({
76
+            message: 'New Message',
77
+            timeout: 6000,
78
+            bgColor: 'white',
79
+            color: 'success',
80
+            dismiss: false,
81
+            shadow: true,
82
+            round: true,
83
+            sm: true,
84
+            icon: 'wi-star'
85
+        })
86
+        },
72
     },
87
     },
73
 }
88
 }
74
 </script>
89
 </script>

Notiek ielāde…
Atcelt
Saglabāt