Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F4637566
service.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
803 B
Referenced Files
None
Subscribers
None
service.js
View Options
var
Promise
=
require
(
"bluebird"
);
var
Service
=
function
(
longid
,
mode
){
this
.
longid
=
longid
;
this
.
event_handlers
=
{};
}
Service
.
prototype
=
new
function
(){
this
.
on
=
function
(
event_name
,
callback
){
if
(
!
this
.
event_handlers
[
event_name
]){
this
.
event_handlers
[
event_name
]
=
callback
;
}
}
this
.
fire_action
=
function
(
event_name
,
payload
){
var
that
=
this
;
return
new
Promise
(
function
(
resolve
,
reject
){
if
(
!
that
.
event_handlers
[
event_name
]){
throw
new
Error
(
"event "
,
event_name
,
"does not have a handler attached"
);
}
else
{
that
.
event_handlers
[
event_name
](
payload
,
function
(){
resolve
();
});
}
})
}
this
.
prepare
=
function
(){
return
true
;
}
this
.
start
=
function
(){
return
true
;
}
}
Service
.
is_a_constructor
=
false
;
module
.
exports
=
Service
;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, May 27, 23:48 (1 d, 20 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
712556
Default Alt Text
service.js (803 B)
Attached To
Mode
rS Sealious
Attached
Detach File
Event Timeline
Log In to Comment