@live-change/frontend-base 0.2.29 → 0.2.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client-entry.js +4 -0
- package/index.js +3 -0
- package/package.json +11 -11
- package/server-entry.js +4 -1
- package/time.js +30 -0
package/client-entry.js
CHANGED
|
@@ -6,10 +6,12 @@ import {
|
|
|
6
6
|
} from 'v-shared-element'
|
|
7
7
|
|
|
8
8
|
import { createApp } from "./main.js"
|
|
9
|
+
import { setTime, startRealTime } from "./time";
|
|
9
10
|
|
|
10
11
|
window.process = { env: {} }
|
|
11
12
|
|
|
12
13
|
export async function clientEntry(App, createRouter, config = {}) {
|
|
14
|
+
setTime(window.__NOW__)
|
|
13
15
|
|
|
14
16
|
const windowId = window.__WINDOW_ID__
|
|
15
17
|
console.error("CLIENT WINDOW ID", windowId)
|
|
@@ -33,6 +35,8 @@ export async function clientEntry(App, createRouter, config = {}) {
|
|
|
33
35
|
router.isReady().then(() => {
|
|
34
36
|
const instance = app.mount('#app', true)
|
|
35
37
|
app._container._vnode = instance.$.vnode
|
|
38
|
+
|
|
39
|
+
startRealTime()
|
|
36
40
|
})
|
|
37
41
|
|
|
38
42
|
}
|
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@live-change/frontend-base",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.30",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"memDev": "lcli memDev --enableSessions --initScript ./init.js --templatePath ../../base-frontend/index.html",
|
|
6
6
|
"localDevInit": "rm tmp.db; lcli localDev --enableSessions --initScript ./init.js",
|
|
@@ -20,17 +20,17 @@
|
|
|
20
20
|
"debug": "node --inspect-brk server"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@live-change/cli": "0.7.
|
|
23
|
+
"@live-change/cli": "0.7.12",
|
|
24
24
|
"@live-change/dao": "0.5.9",
|
|
25
25
|
"@live-change/dao-vue3": "0.5.9",
|
|
26
26
|
"@live-change/dao-websocket": "0.5.9",
|
|
27
|
-
"@live-change/email-service": "0.3.
|
|
28
|
-
"@live-change/password-authentication-service": "0.3.
|
|
29
|
-
"@live-change/secret-code-service": "0.3.
|
|
30
|
-
"@live-change/secret-link-service": "0.3.
|
|
31
|
-
"@live-change/security-frontend": "^0.2.
|
|
32
|
-
"@live-change/session-service": "0.3.
|
|
33
|
-
"@live-change/user-service": "0.3.
|
|
27
|
+
"@live-change/email-service": "0.3.14",
|
|
28
|
+
"@live-change/password-authentication-service": "0.3.14",
|
|
29
|
+
"@live-change/secret-code-service": "0.3.14",
|
|
30
|
+
"@live-change/secret-link-service": "0.3.14",
|
|
31
|
+
"@live-change/security-frontend": "^0.2.30",
|
|
32
|
+
"@live-change/session-service": "0.3.14",
|
|
33
|
+
"@live-change/user-service": "0.3.14",
|
|
34
34
|
"@live-change/vue3-components": "0.2.16",
|
|
35
35
|
"@live-change/vue3-ssr": "0.2.16",
|
|
36
36
|
"@vitejs/plugin-vue": "^2.3.1",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"vue3-scroll-border": "0.1.4"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"@live-change/codeceptjs-helper": "0.7.
|
|
61
|
+
"@live-change/codeceptjs-helper": "0.7.12",
|
|
62
62
|
"@wdio/selenium-standalone-service": "^7.20.8",
|
|
63
63
|
"codeceptjs": "^3.3.4",
|
|
64
64
|
"generate-password": "1.7.0",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"author": "",
|
|
71
71
|
"license": "BSD-3-Clause",
|
|
72
72
|
"description": "",
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "ec841df819a063b90e26052b5583916c58ed7fad"
|
|
74
74
|
}
|
package/server-entry.js
CHANGED
|
@@ -4,6 +4,7 @@ import { renderMetaToString } from 'vue-meta/ssr'
|
|
|
4
4
|
import { serverApi } from '@live-change/vue3-ssr/serverApi.js'
|
|
5
5
|
|
|
6
6
|
import { createApp } from "./main.js"
|
|
7
|
+
import { setTime } from "./time.js";
|
|
7
8
|
|
|
8
9
|
function escapeHtml(unsafe) {
|
|
9
10
|
return (''+unsafe)
|
|
@@ -15,7 +16,9 @@ function escapeHtml(unsafe) {
|
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
export function serverEntry(App, createRouter, config = {}) {
|
|
18
|
-
return async function({ url, headers, dao, windowId }) {
|
|
19
|
+
return async function({ url, headers, dao, windowId, now }) {
|
|
20
|
+
setTime(now)
|
|
21
|
+
|
|
19
22
|
const host = headers['host']
|
|
20
23
|
console.error('URL', host, url)
|
|
21
24
|
const api = await serverApi(dao, {
|
package/time.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ref } from 'vue'
|
|
2
|
+
|
|
3
|
+
export const currentTime = ref(NaN)
|
|
4
|
+
export const realTime = ref(false)
|
|
5
|
+
let updateInterval = null
|
|
6
|
+
|
|
7
|
+
function updateCurrentTime() {
|
|
8
|
+
if(realTime) {
|
|
9
|
+
currentTime.value = Date.now()
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function setTime(time) {
|
|
14
|
+
currentTime.value = time
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function startRealTime() {
|
|
18
|
+
currentTime.value = Date.now()
|
|
19
|
+
realTime.value = true
|
|
20
|
+
updateInterval = setInterval(updateCurrentTime, 500)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function now() {
|
|
24
|
+
if (realTime.value) {
|
|
25
|
+
return Date.now()
|
|
26
|
+
} else {
|
|
27
|
+
return currentTime.value
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|