Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
C
cordis-decorators
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
3rdeye
cordis-decorators
Commits
17dc75ff
Commit
17dc75ff
authored
Jul 21, 2022
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
put decorateMethod into info
parent
20ed2d33
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
6 deletions
+14
-6
src/registrar-aspect.ts
src/registrar-aspect.ts
+3
-2
src/registrar.ts
src/registrar.ts
+11
-4
No files found.
src/registrar-aspect.ts
View file @
17dc75ff
...
...
@@ -57,9 +57,10 @@ export class RegistrarAspect<Ctx extends Context, T = any> {
const
data
=
this
.
registrar
.
reflector
.
get
(
'
CordisRegister
'
,
this
.
obj
,
key
);
if
(
!
data
)
return
;
const
specificCtx
=
this
.
getScopeContext
(
ctx
,
key
,
extraView
,
false
);
const
view
=
{
...
this
.
view
,
...
extraView
};
const
result
=
data
.
run
(
{
...
this
.
view
,
...
extraView
}
,
specificCtx
,
view
,
{
ctx
:
specificCtx
,
obj
:
this
.
obj
,
key
,
view
}
,
extractObjectMethod
(
this
.
obj
,
key
),
);
return
{
...
...
src/registrar.ts
View file @
17dc75ff
...
...
@@ -57,11 +57,18 @@ export namespace Registrar {
R
=
any
,
>
=
(
ctx
:
Ctx
,
param
:
P
,
...
args
:
A
)
=>
R
;
export
interface
MethodResolveInfo
<
Ctx
extends
Context
>
{
ctx
:
Ctx
;
obj
:
any
;
key
:
string
;
view
:
any
;
}
export
type
MethodResolver
<
Ctx
extends
Context
,
A
extends
any
[]
=
any
[],
F
extends
(...
args
:
any
[])
=>
any
=
(...
args
:
any
[])
=>
any
,
>
=
DecorateFunctionParamSingle
<
Ctx
,
F
,
A
>
;
>
=
(
info
:
MethodResolveInfo
<
Ctx
>
,
fun
:
F
,
...
args
:
A
)
=>
any
;
export
type
MethodMeta
<
Ctx
extends
Context
>
=
RegisterMeta
<
MethodResolver
<
Ctx
>
,
...
...
@@ -422,13 +429,13 @@ export class Registrar<Ctx extends Context> {
return
{
UseEvent
:
this
.
decorateMethod
(
'
on
'
,
(
ctx
,
fun
,
event
:
keyof
GetEvents
<
Ctx
>
,
prepend
?:
boolean
)
=>
(
{
ctx
}
,
fun
,
event
:
keyof
GetEvents
<
Ctx
>
,
prepend
?:
boolean
)
=>
ctx
.
on
(
event
as
any
,
fun
,
prepend
),
),
UsePlugin
:
this
.
decorateMethod
(
'
plugin
'
,
(
ctx
,
{
ctx
}
,
fun
:
(
...
args
:
any
[]
)
=>
Awaitable
<
PluginRegistrar
.
PluginDefinition
<
Ctx
>>
,
...
...
@@ -447,7 +454,7 @@ export class Registrar<Ctx extends Context> {
}
},
),
Apply
:
this
.
decorateMethod
(
'
apply
'
,
(
ctx
,
fun
)
=>
fun
()),
Apply
:
this
.
decorateMethod
(
'
apply
'
,
(
info
,
fun
)
=>
fun
()),
};
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment