Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F10361196
notifications.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
922 B
Referenced Files
None
Subscribers
None
notifications.ts
View Options
import
*
as
shared
from
"./shared"
;
const
notifications
=
document
.
getElementById
(
"notifications"
)
!
;
function
create_notification
(
notification
:
{
is_ok
:
boolean
;
message
:
string
;
context
:
string
;
})
:
HTMLElement
{
const
el
=
document
.
createElement
(
"div"
);
el
.
addEventListener
(
"click"
,
(
_
)
=>
{
el
.
remove
();
});
el
.
classList
.
add
(
"notification"
);
if
(
notification
.
is_ok
)
el
.
classList
.
add
(
"notification_ok"
);
else
el
.
classList
.
add
(
"notification_err"
);
// el.innerText = notification.message;
el
.
innerHTML
=
`
<div><b>
${
notification
.
context
}
</b></div>
<div>
${
notification
.
message
.
split
(
"\n"
)
.
map
((
line
)
=>
`<p>
${
line
}
</p>`
)
.
join
(
""
)
}
</div>`
;
return
el
;
}
export
function
start_notifications
()
{
shared
.
socket
.
on
(
"notification"
,
(
data
)
=>
{
let
el
=
create_notification
(
data
);
notifications
.
appendChild
(
el
);
// a 10 sec timeout
setTimeout
(()
=>
{
el
.
remove
();
},
10000
);
});
}
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Sat, Nov 8, 12:02 (21 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1034554
Default Alt Text
notifications.ts (922 B)
Attached To
Mode
R134 rentgen-android
Attached
Detach File
Event Timeline
Log In to Comment