Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2895208
AphlictListener.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
1 KB
Referenced Files
None
Subscribers
None
AphlictListener.js
View Options
'use strict'
;
var
JX
=
require
(
'./javelin'
).
JX
;
JX
.
install
(
'AphlictListener'
,
{
construct
:
function
(
id
,
socket
)
{
this
.
_id
=
id
;
this
.
_socket
=
socket
;
},
members
:
{
_id
:
null
,
_socket
:
null
,
_subscriptions
:
{},
getID
:
function
()
{
return
this
.
_id
;
},
subscribe
:
function
(
phids
)
{
for
(
var
i
=
0
;
i
<
phids
.
length
;
i
++
)
{
var
phid
=
phids
[
i
];
this
.
_subscriptions
[
phid
]
=
true
;
}
return
this
;
},
unsubscribe
:
function
(
phids
)
{
for
(
var
i
=
0
;
i
<
phids
.
length
;
i
++
)
{
var
phid
=
phids
[
i
];
delete
this
.
_subscriptions
[
phid
];
}
return
this
;
},
isSubscribedToAny
:
function
(
phids
)
{
var
intersection
=
phids
.
filter
(
function
(
phid
)
{
return
phid
in
this
.
_subscriptions
;
},
this
);
return
intersection
.
length
>
0
;
},
getSocket
:
function
()
{
return
this
.
_socket
;
},
getDescription
:
function
()
{
return
'Listener/'
+
this
.
getID
();
},
writeMessage
:
function
(
message
)
{
this
.
_socket
.
send
(
JSON
.
stringify
(
message
));
},
},
});
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Jan 19 2025, 21:06 (6 w, 1 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1128753
Default Alt Text
AphlictListener.js (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment