Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
verona-modules-aspect
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IQB
verona-modules-aspect
Commits
faedd266
Commit
faedd266
authored
2 years ago
by
jojohoch
Browse files
Options
Downloads
Patches
Plain Diff
[player] Avoid sending change notification twice in PlayerStateDirective
- Refactor subscriptions for verona commands
parent
5014b9f5
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
projects/player/src/app/directives/player-state.directive.ts
+15
-12
15 additions, 12 deletions
projects/player/src/app/directives/player-state.directive.ts
with
15 additions
and
12 deletions
projects/player/src/app/directives/player-state.directive.ts
+
15
−
12
View file @
faedd266
import
{
Directive
,
Input
,
OnChanges
,
OnInit
,
SimpleChanges
}
from
'
@angular/core
'
;
import
{
Directive
,
Input
,
OnChanges
,
OnInit
,
SimpleChanges
}
from
'
@angular/core
'
;
import
{
import
{
PlayerState
,
RunningState
PlayerState
,
RunningState
}
from
'
player/modules/verona/models/verona
'
;
}
from
'
player/modules/verona/models/verona
'
;
import
{
BehaviorSubject
,
Subject
}
from
'
rxjs
'
;
import
{
BehaviorSubject
,
map
,
merge
,
Subject
}
from
'
rxjs
'
;
import
{
VeronaSubscriptionService
}
from
'
player/modules/verona/services/verona-subscription.service
'
;
import
{
VeronaSubscriptionService
}
from
'
player/modules/verona/services/verona-subscription.service
'
;
import
{
VeronaPostService
}
from
'
player/modules/verona/services/verona-post.service
'
;
import
{
VeronaPostService
}
from
'
player/modules/verona/services/verona-post.service
'
;
import
{
takeUntil
}
from
'
rxjs/operators
'
;
import
{
takeUntil
}
from
'
rxjs/operators
'
;
...
@@ -25,7 +29,6 @@ export class PlayerStateDirective implements OnInit, OnChanges {
...
@@ -25,7 +29,6 @@ export class PlayerStateDirective implements OnInit, OnChanges {
ngOnInit
():
void
{
ngOnInit
():
void
{
this
.
initSubscriptions
();
this
.
initSubscriptions
();
this
.
sendVopStateChangedNotification
();
}
}
ngOnChanges
(
changes
:
SimpleChanges
):
void
{
ngOnChanges
(
changes
:
SimpleChanges
):
void
{
...
@@ -35,15 +38,15 @@ export class PlayerStateDirective implements OnInit, OnChanges {
...
@@ -35,15 +38,15 @@ export class PlayerStateDirective implements OnInit, OnChanges {
}
}
private
initSubscriptions
():
void
{
private
initSubscriptions
():
void
{
this
.
veronaSubscriptionService
.
vopContinueCommand
merge
(
.
pipe
(
takeUntil
(
this
.
ngUnsubscribe
))
this
.
veronaSubscriptionService
.
vopContinueCommand
.
subscribe
(()
=>
this
.
setAndSendRunningState
(
true
))
;
.
pipe
(
map
(()
=>
true
))
,
this
.
veronaSubscriptionService
.
vopStopCommand
this
.
veronaSubscriptionService
.
vopStopCommand
.
pipe
(
takeUntil
(
this
.
ngUnsubscrib
e
))
.
pipe
(
map
(()
=>
fals
e
))
,
.
subscribe
(()
=>
this
.
setAndSendRunningState
(
false
));
this
.
veronaSubscriptionService
.
vopGetStateRequest
this
.
veronaSubscriptionService
.
vopGetStateRequest
.
pipe
(
map
(
message
=>
(
!
message
.
stop
&&
this
.
state
===
'
running
'
)))
.
pipe
(
takeUntil
(
this
.
ngUnsubscribe
))
)
.
pipe
(
takeUntil
(
this
.
ngUnsubscribe
))
.
subscribe
(
message
=>
this
.
setAndSendRunningState
(
(
!
message
.
stop
&&
this
.
state
===
'
r
unning
'
)
));
.
subscribe
(
isRunning
=>
this
.
setAndSendRunningState
(
isR
unning
));
}
}
private
get
state
():
RunningState
{
private
get
state
():
RunningState
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment