Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F9584171
field-type.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
field-type.js
View Options
"use strict"
;
const
locreq
=
require
(
"locreq"
)(
__dirname
);
const
Promise
=
require
(
"bluebird"
);
const
Errors
=
locreq
(
"lib/response/error.js"
);
const
default_methods
=
require
(
"./field-type-default-methods.js"
);
function
wrap_method_in_promise
(
context
,
declaration
,
method_name
)
{
return
function
()
{
return
Promise
.
resolve
(
declaration
[
method_name
].
apply
(
context
,
arguments
)
);
};
}
const
FieldType
=
function
(
app
,
declaration
)
{
let
self
;
if
(
declaration
instanceof
FieldType
)
{
return
declaration
;
}
else
if
(
typeof
declaration
===
"string"
)
{
return
app
.
ChipManager
.
get_chip
(
"field_type"
,
declaration
);
}
else
if
(
declaration
.
extends
)
{
const
parent_field_type
=
app
.
ChipManager
.
get_chip
(
"field_type"
,
declaration
.
extends
);
self
=
Object
.
create
(
parent_field_type
);
}
else
{
self
=
this
;
for
(
const
method_name
in
default_methods
)
{
self
[
method_name
]
=
default_methods
[
method_name
];
}
}
for
(
const
prop_name
in
declaration
)
{
if
(
default_methods
[
prop_name
]
!==
undefined
&&
typeof
self
[
prop_name
]
===
"function"
)
{
self
[
prop_name
]
=
wrap_method_in_promise
(
self
,
declaration
,
prop_name
);
self
[
prop_name
].
origin
=
declaration
.
name
;
}
else
{
self
[
prop_name
]
=
declaration
[
prop_name
];
}
}
return
self
;
};
FieldType
.
type_name
=
"field_type"
;
module
.
exports
=
FieldType
;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Oct 11, 11:55 (1 m, 31 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
968062
Default Alt Text
field-type.js (1 KB)
Attached To
Mode
rS Sealious
Attached
Detach File
Event Timeline
Log In to Comment