Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F995672
metadata.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
946 B
Referenced Files
None
Subscribers
None
metadata.ts
View Options
import
type
{
App
}
from
"../main.js"
;
export
const
METADATA_COLLECTION_NAME
=
"_metadata"
;
export
default
class
Metadata
{
db_collection_name
=
METADATA_COLLECTION_NAME
;
app
:
App
;
constructor
(
app
:
App
)
{
this
.
app
=
app
;
}
async
get
(
key
:
string
|
number
)
{
const
matches
=
await
this
.
app
.
Datastore
.
find
(
METADATA_COLLECTION_NAME
,
{
key
}
);
if
(
matches
.
length
)
{
return
matches
[
0
].
value
;
}
else
{
return
undefined
;
}
}
async
set
(
key
:
string
,
value
:
string
|
number
)
{
const
matches
=
await
this
.
app
.
Datastore
.
find
(
METADATA_COLLECTION_NAME
,
{
key
}
);
if
(
matches
.
length
)
{
await
this
.
app
.
Datastore
.
update
(
METADATA_COLLECTION_NAME
,
{
key
:
key
},
{
$set
:
{
value
:
value
}
}
);
}
else
{
await
this
.
app
.
Datastore
.
insert
(
METADATA_COLLECTION_NAME
,
{
key
,
value
,
});
}
}
async
clear
()
{
return
this
.
app
.
Datastore
.
remove
(
METADATA_COLLECTION_NAME
,
{},
false
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Mon, Dec 23, 13:04 (1 d, 18 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
556080
Default Alt Text
metadata.ts (946 B)
Attached To
Mode
rS Sealious
Attached
Detach File
Event Timeline
Log In to Comment