@knowlearning/agents 0.9.142 → 0.9.144
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/download-url-registry.js +1 -0
- package/package.json +1 -1
- package/vue/image.vue +31 -0
- package/vue.js +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default {}
|
package/package.json
CHANGED
package/vue/image.vue
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<image
|
|
3
|
+
:key="downloadURL"
|
|
4
|
+
:src="downloadURL"
|
|
5
|
+
/>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script setup>
|
|
9
|
+
import { ref } from 'vue'
|
|
10
|
+
import downloadURLRegistry from '../download-url-registry.js'
|
|
11
|
+
|
|
12
|
+
const props = defineProps({ id: String })
|
|
13
|
+
|
|
14
|
+
const downloadURL = ref(downloadURLRegistry[props.id])
|
|
15
|
+
|
|
16
|
+
if (!downloadURL.value) setDownloadURL()
|
|
17
|
+
|
|
18
|
+
watch(props, setDownloadURL)
|
|
19
|
+
|
|
20
|
+
let latestRequest = 0
|
|
21
|
+
async function setDownloadURL() {
|
|
22
|
+
downloadURL.value = null
|
|
23
|
+
latestRequest += 1
|
|
24
|
+
|
|
25
|
+
const thisRequest = latestRequest
|
|
26
|
+
const newURL = downloadURLRegistry[props.id] || await Agent.download(props.id).url()
|
|
27
|
+
|
|
28
|
+
downloadURLRegistry[props.id] = newURL
|
|
29
|
+
if (latestRequest === thisRequest) downloadURL.value = newURL
|
|
30
|
+
}
|
|
31
|
+
</script>
|
package/vue.js
CHANGED
|
@@ -3,3 +3,4 @@ export { default as vuePersistentComponent } from './vue/3/persist/component.js'
|
|
|
3
3
|
export { default as vueEmbedComponent } from './vue/3/components/embed.vue'
|
|
4
4
|
export { default as vueNameComponent } from './vue/3/components/name.vue'
|
|
5
5
|
export { default as vueScopeComponent } from './vue/3/components/scope.vue'
|
|
6
|
+
export { default as UUIDImage } from './vue/image.vue'
|