Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
K
Koishi Thirdeye
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
Koishi Thirdeye
Commits
5c61c08d
Commit
5c61c08d
authored
Jun 16, 2022
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rework register sequence
parent
633fb72f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
28 deletions
+28
-28
src/register.ts
src/register.ts
+28
-28
No files found.
src/register.ts
View file @
5c61c08d
...
...
@@ -146,8 +146,8 @@ export function DefinePlugin<T>(
}
_registerDeclarationsProcess
(
methodKey
:
keyof
C
&
string
,
ctx
:
Context
,
methodKey
:
keyof
C
&
string
,
view
:
Record
<
string
,
any
>
=
{},
)
{
const
result
=
this
.
__registrar
.
register
(
ctx
,
methodKey
,
false
,
view
);
...
...
@@ -163,33 +163,14 @@ export function DefinePlugin<T>(
}
}
_registerDeclarationsResolving
(
methodKey
:
keyof
C
&
string
,
view
:
Record
<
string
,
any
>
=
{},
)
{
const
ctx
=
this
.
__registrar
.
getScopeContext
(
this
.
__ctx
,
methodKey
,
false
,
);
const
sub
=
this
.
__registrar
.
runLayers
(
ctx
,
(
innerCtx
)
=>
this
.
_registerDeclarationsProcess
(
methodKey
,
innerCtx
,
view
),
methodKey
,
)
.
subscribe
();
this
.
__disposables
.
push
(()
=>
sub
.
unsubscribe
());
}
_registerDeclarationsWithStack
(
ctx
:
Context
,
methodKey
:
keyof
C
&
string
,
stack
:
ControlType
[],
existing
:
Record
<
string
,
any
>
=
{},
)
{
if
(
!
stack
.
length
)
{
return
this
.
_registerDeclarations
Resolving
(
methodKey
,
existing
);
return
this
.
_registerDeclarations
Process
(
ctx
,
methodKey
,
existing
);
}
const
rest
=
[...
stack
];
const
control
=
rest
.
pop
();
...
...
@@ -199,6 +180,7 @@ export function DefinePlugin<T>(
if
(
!
(
control
as
ControlType
<
'
if
'
>
).
condition
(
this
,
existing
))
return
;
return
this
.
_registerDeclarationsWithStack
(
ctx
,
methodKey
,
rest
,
existing
,
...
...
@@ -208,7 +190,7 @@ export function DefinePlugin<T>(
this
,
existing
,
))
{
this
.
_registerDeclarationsWithStack
(
methodKey
,
rest
,
{
this
.
_registerDeclarationsWithStack
(
ctx
,
methodKey
,
rest
,
{
...
existing
,
...
view
,
});
...
...
@@ -217,17 +199,35 @@ export function DefinePlugin<T>(
}
}
_registerDeclarationsFor
(
methodKey
:
keyof
C
&
string
)
{
_registerDeclarationsFor
(
ctx
:
Context
,
methodKey
:
keyof
C
&
string
)
{
const
scopeCtx
=
this
.
__registrar
.
getScopeContext
(
this
.
__ctx
,
methodKey
,
false
,
);
const
stack
=
reflector
.
getArray
(
'
KoishiControl
'
,
this
,
methodKey
);
return
this
.
_registerDeclarationsWithStack
(
methodKey
,
stack
);
const
sub
=
this
.
__registrar
.
runLayers
(
scopeCtx
,
(
innerCtx
)
=>
this
.
_registerDeclarationsWithStack
(
innerCtx
,
methodKey
,
stack
),
methodKey
,
)
.
subscribe
();
scopeCtx
.
on
(
'
dispose
'
,
()
=>
sub
.
unsubscribe
());
}
_registerDeclarations
()
{
const
methodKeys
=
this
.
__registrar
.
getAllFieldsToRegister
()
as
(
keyof
C
&
string
)[];
methodKeys
.
forEach
((
methodKey
)
=>
this
.
_registerDeclarationsFor
(
methodKey
),
);
const
sub
=
this
.
__registrar
.
runLayers
(
this
.
__ctx
,
(
innerCtx
)
=>
methodKeys
.
forEach
((
methodKey
)
=>
this
.
_registerDeclarationsFor
(
innerCtx
,
methodKey
),
),
)
.
subscribe
();
this
.
__disposables
.
push
(()
=>
sub
.
unsubscribe
());
}
_getProvidingServices
()
{
...
...
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