Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frama-c
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
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
pub
frama-c
Commits
759fdd31
Commit
759fdd31
authored
2 years ago
by
Loïc Correnson
Committed by
David Bühler
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[dome] optional forced update on GlobalStates
parent
978a687e
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
ivette/src/dome/renderer/data/states.ts
+7
-3
7 additions, 3 deletions
ivette/src/dome/renderer/data/states.ts
with
7 additions
and
3 deletions
ivette/src/dome/renderer/data/states.ts
+
7
−
3
View file @
759fdd31
...
@@ -107,9 +107,13 @@ export class GlobalState<A> {
...
@@ -107,9 +107,13 @@ export class GlobalState<A> {
/** Current state value. */
/** Current state value. */
getValue
():
A
{
return
this
.
value
;
}
getValue
():
A
{
return
this
.
value
;
}
/** Notify callbacks on change, using _deep_ structural comparison. */
/** Notify callbacks on change. By default, changed are detected
setValue
(
value
:
A
):
void
{
by using _deep_ structural comparison, using `react-fast-compare` comparison.
if
(
!
isEqual
(
value
,
this
.
value
))
{
@param value the new value of the state
@param forced when set to `true`, notify callbacks without comparison.
*/
setValue
(
value
:
A
,
forced
=
false
):
void
{
if
(
forced
||
!
isEqual
(
value
,
this
.
value
))
{
this
.
value
=
value
;
this
.
value
=
value
;
this
.
emitter
.
emit
(
UPDATE
,
value
);
this
.
emitter
.
emit
(
UPDATE
,
value
);
}
}
...
...
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