1
- export default async function ( { addon, global, cons, msg } ) {
1
+ import addSmallStageClass from "../../libraries/common/cs/small-stage.js" ;
2
+
3
+ export default async function ( { addon, console, msg } ) {
4
+
2
5
await new Promise ( ( resolve ) => {
3
6
if ( addon . tab . traps . vm . editingTarget ) return resolve ( ) ;
4
7
addon . tab . traps . vm . runtime . once ( "PROJECT_LOADED" , resolve ) ;
@@ -9,20 +12,8 @@ export default async function ({ addon, global, cons, msg }) {
9
12
let fpsCounterElement = document . createElement ( "span" ) ;
10
13
fpsCounterElement . className = "fps-counter" ;
11
14
12
- function updateVisibility ( ) {
13
- if ( addon . tab . redux && addon . tab . redux . state . scratchGui . stageSize . stageSize === "small" ) {
14
- fpsCounterElement . style . display = "none" ;
15
- } else {
16
- addon . tab . displayNoneWhileDisabled ( fpsCounterElement , { display : "flex" } ) ;
17
- }
18
- }
19
-
20
- updateVisibility ( ) ;
21
-
22
- addon . tab . redux . addEventListener ( "statechanged" , ( { detail } ) => {
23
- if ( detail . action . type !== "scratch-gui/StageSize/SET_STAGE_SIZE" ) return ;
24
- updateVisibility ( ) ;
25
- } ) ;
15
+ addon . tab . displayNoneWhileDisabled ( fpsCounterElement ) ;
16
+ addSmallStageClass ( ) ;
26
17
27
18
const renderTimes = [ ] ;
28
19
var fps = "?" ;
@@ -46,7 +37,6 @@ export default async function ({ addon, global, cons, msg }) {
46
37
markAsSeen : true ,
47
38
reduxEvents : [ "scratch-gui/mode/SET_PLAYER" , "fontsLoaded/SET_FONTS_LOADED" , "scratch-gui/locales/SELECT_LOCALE" ] ,
48
39
} ) ;
49
- console . log ( "Hai :D" ) ;
50
40
addon . tab . appendToSharedSpace ( { space : "afterStopButton" , element : fpsCounterElement , order : 3 } ) ;
51
41
}
52
42
}
0 commit comments