ngx-rendering-service-lib 0.0.66860 → 0.0.66861
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.
|
@@ -6,7 +6,7 @@ const ASSET_PATH = "public/asset"
|
|
|
6
6
|
const DB_NAME = "Edu-Sharing-Rendering"
|
|
7
7
|
const DB_STORE = "SessionIds"
|
|
8
8
|
/** @type {IDBDatabase} */
|
|
9
|
-
let
|
|
9
|
+
let eduServiceWorkerDb
|
|
10
10
|
|
|
11
11
|
self.addEventListener('install', async function (event) {
|
|
12
12
|
// Skip the 'waiting' lifecycle phase, to go directly from 'installed' to 'activated', even if
|
|
@@ -109,7 +109,7 @@ const handleStandardRequest = async (request) => {
|
|
|
109
109
|
*/
|
|
110
110
|
const getDb = () => {
|
|
111
111
|
return new Promise((resolve, reject) => {
|
|
112
|
-
if (
|
|
112
|
+
if (eduServiceWorkerDb !== undefined) {
|
|
113
113
|
resolve("success")
|
|
114
114
|
}
|
|
115
115
|
if (!indexedDB) {
|
|
@@ -125,7 +125,7 @@ const getDb = () => {
|
|
|
125
125
|
newDb.createObjectStore(DB_STORE, {keyPath: "id"})
|
|
126
126
|
}
|
|
127
127
|
request.onsuccess = () => {
|
|
128
|
-
|
|
128
|
+
eduServiceWorkerDb = request.result
|
|
129
129
|
resolve("success")
|
|
130
130
|
}
|
|
131
131
|
})
|
|
@@ -138,7 +138,7 @@ const getDb = () => {
|
|
|
138
138
|
*/
|
|
139
139
|
const storeSessionIdToDb = (sessionId) => {
|
|
140
140
|
return new Promise((resolve, reject) => {
|
|
141
|
-
const transaction =
|
|
141
|
+
const transaction = eduServiceWorkerDb.transaction(DB_STORE, "readwrite")
|
|
142
142
|
const store = transaction.objectStore(DB_STORE)
|
|
143
143
|
store.put({id: 1, sessionId: sessionId})
|
|
144
144
|
transaction.oncomplete = () => {
|
|
@@ -168,7 +168,7 @@ const storeSessionIdToDb = (sessionId) => {
|
|
|
168
168
|
const retrieveSessionIdFromDb = () => {
|
|
169
169
|
return new Promise((resolve, reject) => {
|
|
170
170
|
let result = ""
|
|
171
|
-
const transaction =
|
|
171
|
+
const transaction = eduServiceWorkerDb.transaction(DB_STORE, "readonly")
|
|
172
172
|
const store = transaction.objectStore(DB_STORE)
|
|
173
173
|
const idQuery = store.get(1)
|
|
174
174
|
idQuery.onsuccess = () => {
|