Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
boytacean
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
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
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
João Magalhães
boytacean
Commits
a6e5b7f2
Verified
Commit
a6e5b7f2
authored
7 months ago
by
João Magalhães
Browse files
Options
Downloads
Patches
Plain Diff
chore: small perf improvement using useCallback
parent
65815c2c
No related branches found
No related tags found
No related merge requests found
Pipeline
#4995
passed
7 months ago
Stage: build
Stage: test
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
frontends/web/react/components/debug/debug.tsx
+31
-20
31 additions, 20 deletions
frontends/web/react/components/debug/debug.tsx
with
31 additions
and
20 deletions
frontends/web/react/components/debug/debug.tsx
+
31
−
20
View file @
a6e5b7f2
import
React
,
{
FC
,
useEffect
,
useState
}
from
"
react
"
;
import
React
,
{
FC
,
useCallback
,
useEffect
,
useState
}
from
"
react
"
;
import
{
ButtonSwitch
,
Info
,
Pair
}
from
"
emukit
"
;
import
{
ButtonSwitch
,
Info
,
Pair
}
from
"
emukit
"
;
import
{
AudioGB
}
from
"
../audio-gb/audio-gb
"
;
import
{
AudioGB
}
from
"
../audio-gb/audio-gb
"
;
import
{
RegistersGB
}
from
"
../registers-gb/registers-gb
"
;
import
{
RegistersGB
}
from
"
../registers-gb/registers-gb
"
;
...
@@ -92,25 +92,36 @@ const DebugSettingsContent: FC<EmulatorProps> = ({ emulator }) => {
...
@@ -92,25 +92,36 @@ const DebugSettingsContent: FC<EmulatorProps> = ({ emulator }) => {
};
};
},
[
emulator
]);
},
[
emulator
]);
const
onPpuChange
=
(
option
:
string
)
=>
{
const
onPpuChange
=
useCallback
(
emulator
.
instance
?.
set_ppu_enabled
(
option
===
"
on
"
);
(
option
:
string
)
=>
{
};
emulator
.
instance
?.
set_ppu_enabled
(
option
===
"
on
"
);
},
const
onApuChange
=
(
option
:
string
)
=>
{
[
emulator
]
emulator
.
instance
?.
set_apu_enabled
(
option
===
"
on
"
);
);
};
const
onApuChange
=
useCallback
(
(
option
:
string
)
=>
{
const
onDmaChange
=
(
option
:
string
)
=>
{
emulator
.
instance
?.
set_apu_enabled
(
option
===
"
on
"
);
emulator
.
instance
?.
set_dma_enabled
(
option
===
"
on
"
);
},
};
[
emulator
]
);
const
onTimerChange
=
(
option
:
string
)
=>
{
const
onDmaChange
=
useCallback
(
emulator
.
instance
?.
set_timer_enabled
(
option
===
"
on
"
);
(
option
:
string
)
=>
{
};
emulator
.
instance
?.
set_dma_enabled
(
option
===
"
on
"
);
},
const
onSerialChange
=
(
option
:
string
)
=>
{
[
emulator
]
emulator
.
instance
?.
set_serial_enabled
(
option
===
"
on
"
);
);
};
const
onTimerChange
=
useCallback
(
(
option
:
string
)
=>
{
emulator
.
instance
?.
set_timer_enabled
(
option
===
"
on
"
);
},
[
emulator
]
);
const
onSerialChange
=
useCallback
(
(
option
:
string
)
=>
{
emulator
.
instance
?.
set_serial_enabled
(
option
===
"
on
"
);
},
[
emulator
]
);
return
(
return
(
<
Info
key
=
{
updated
}
>
<
Info
key
=
{
updated
}
>
...
...
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