How to use isRunning method in root

Best JavaScript code snippet using root

menu.js

Source:menu.js Github

copy

Full Screen

...93 click: () => win.setFullScreen(!win.isFullScreen()) },94 { label: 'Minimize', accelerator: 'CmdOrCtrl+M', role: 'minimize' },95 { type: 'separator' },96 { label: 'Screen Scale', submenu: [97 { label: 'Original', type: 'checkbox', enabled: !box.isRunning(),98 checked: !scale, click: () => changeScale('none') },99 { type: 'separator' },100 { label: '2x Scale', type: 'checkbox', enabled: !box.isRunning(),101 checked: scale === '2x', click: () => changeScale('2x') },102 { label: '3x Scale', type: 'checkbox', enabled: !box.isRunning(),103 checked: scale === '3x', click: () => changeScale('3x') }]104 },105 { label: 'Rendering Style', submenu: [106 { label: 'None', type: 'checkbox', enabled: !box.isRunning(),107 checked: !!scaler.match(/none|normal/),108 click: () => changeStyle(!scale ? 'none' : 'normal') },109 { type: 'separator' },110 { label: 'Fast Smoothing', type: 'checkbox', enabled: !!scale && !box.isRunning(),111 checked: scaler === 'advmame', click: () => changeStyle('advmame') },112 { label: 'Adv. Smoothing', type: 'checkbox', enabled: !!scale && !box.isRunning(),113 checked: scaler === 'advinterp',114 click: () => changeStyle('advinterp') },115 { label: 'Fancy Smoothing', type: 'checkbox', enabled: !!scale && !box.isRunning(),116 checked: scaler === 'hq', click: () => changeStyle('hq') },117 { type: 'separator' },118 { label: 'Super Smoothing', type: 'checkbox', enabled: scale === '2x' && !box.isRunning(),119 checked: scaler === 'super2xsai', click: () => changeStyle('super2xsai') },120 { label: 'Soft Smoothing', type: 'checkbox', enabled: scale === '2x' && !box.isRunning(),121 checked: scaler === '2xsai', click: () => changeStyle('2xsai') },122 { label: 'Super Eagle', type: 'checkbox', enabled: scale === '2x' && !box.isRunning(),123 checked: scaler === 'supereagle', click: () => changeStyle('supereagle') },124 { type: 'separator' },125 { label: 'RGB Phosphors', type: 'checkbox', enabled: !!scale && !box.isRunning(),126 checked: scaler === 'rgb', click: () => changeStyle('rgb') },127 { label: 'TV Scanlines', type: 'checkbox', enabled: !!scale && !box.isRunning(),128 checked: scaler === 'tv', click: () => changeStyle('tv') },129 { label: 'Scanlines', type: 'checkbox', enabled: !!scale && !box.isRunning(),130 checked: scaler === 'scan', click: () => changeStyle('scan2x') }131 ]},132 { label: 'Use 4:3 Aspect Ratio', accelerator: 'CmdOrCtrl+Shift+A',133 type: 'checkbox', checked: box.isAspectRatio, click: () => box.toggleAspectRatio() },134 { type: 'separator' },135 { label: 'Show Developer Tools', accelerator: isDarwin ? 'Alt+Command+I' : 'Ctrl+Shift+I',136 type: 'checkbox', checked: win.isDevToolsOpened(),137 click: () => win.toggleDevTools() }138 ]139 },140 {141 label: 'Game',142 submenu: [143 { label: 'Save Status', accelerator: 'CmdOrCtrl+S', enabled: box.isRunning(),144 click: () => box.saveStatus() },145 { label: 'Load Status', accelerator: 'CmdOrCtrl+L', enabled: box.isRunning(),146 click: () => box.loadStatus() },147 { type: 'separator' },148 { label: 'Pause', accelerator: 'CmdOrCtrl+F', enabled: box.isRunning(),149 type: 'checkbox', checked: box.isPaused(), click: () => box.togglePause() },150 { label: 'Mouse Lock', accelerator: 'CmdOrCtrl+P',151 type: 'checkbox', checked: box.isMouseLocked, click: () => box.toggleMouseLock() },152 { label: 'Mute Sound', accelerator: 'CmdOrCtrl+M', enabled: box.isRunning(),153 type: 'checkbox', checked: box.isMuted(), click: () => box.muteSound() },154 { label: 'Send Key', submenu: [] },155 { type: 'separator' },156 { label: 'Exit Game', accelerator: 'CmdOrCtrl+W', enabled: box.isRunning(),157 click: () => box.exitGame() }158 ]159 },160 {161 label: 'Emulation',162 submenu: [163 { label: 'CPU Type', submenu: [164 { label: 'Auto', type: 'checkbox', enabled: !box.isRunning(),165 checked: cpuType === 'auto',166 click: () => app.saveConf('cpu', 'cputype', 'auto') },167 { type: 'separator' },168 { label: '386', type: 'checkbox', enabled: !box.isRunning(),169 checked: cpuType === '386',170 click: () => app.saveConf('cpu', 'cputype', '386') },171 { label: '386 Slow', type: 'checkbox', enabled: !box.isRunning(),172 checked: cpuType === '386_slow',173 click: () => app.saveConf('cpu', 'cputype', '386_slow') },174 { label: '386 Prefetch', type: 'checkbox', enabled: !box.isRunning(),175 checked: cpuType === '386_prefetch',176 click: () => app.saveConf('cpu', 'cputype', '386_prefetch') },177 { label: '486 Slow', type: 'checkbox', enabled: !box.isRunning(),178 checked: cpuType === '486_slow',179 click: () => app.saveConf('cpu', 'cputype', '486_slow') },180 { label: 'Pentium Slow', type: 'checkbox', enabled: !box.isRunning(),181 checked: cpuType === 'pentium_slow',182 click: () => app.saveConf('cpu', 'cputype', 'pentium_slow') }183 ] },184 { label: 'CPU Core', submenu: [185 { label: 'Auto', type: 'checkbox', enabled: !box.isRunning(),186 checked: cpuCore === 'auto',187 click: () => app.saveConf('cpu', 'core', 'auto') },188 { type: 'separator' },189 { label: 'Dynamic', type: 'checkbox', enabled: !box.isRunning(),190 checked: cpuCore === 'dynamic',191 click: () => app.saveConf('cpu', 'core', 'dynamic') },192 { label: 'Normal', type: 'checkbox', enabled: !box.isRunning(),193 checked: cpuCore === 'normal',194 click: () => app.saveConf('cpu', 'core', 'normal') },195 { label: 'Simple', type: 'checkbox', enabled: !box.isRunning(),196 checked: cpuCore === 'simple',197 click: () => app.saveConf('cpu', 'core', 'simple') }198 ] },199 { type: 'separator' },200 { label: 'CPU Cycles Auto', type: 'checkbox', enabled: !box.isRunning(),201 checked: cpuCycles === 'auto',202 click: () => app.saveConf('cpu', 'cycles', 'auto') },203 { label: 'CPU Cycles Max', type: 'checkbox', enabled: !box.isRunning(),204 checked: cpuCycles === 'max',205 click: () => app.saveConf('cpu', 'cycles', 'max') },206 { label: 'Fixed 200000(Pentium II)', type: 'checkbox', enabled: !box.isRunning(),207 checked: cpuCycles === 'fixed 200000',208 click: () => app.saveConf('cpu', 'cycles', 'fixed 200000') },209 { label: 'Fixed 77000(Pentium)', type: 'checkbox', enabled: !box.isRunning(),210 checked: cpuCycles === 'fixed 77000',211 click: () => app.saveConf('cpu', 'cycles', 'fixed 77000') },212 { label: 'Fixed 26800(486)', type: 'checkbox', enabled: !box.isRunning(),213 checked: cpuCycles === 'fixed 26800',214 click: () => app.saveConf('cpu', 'cycles', 'fixed 26800') },215 { label: 'Fixed 7800(386)', type: 'checkbox', enabled: !box.isRunning(),216 checked: cpuCycles === 'fixed 7800',217 click: () => app.saveConf('cpu', 'cycles', 'fixed 7800') },218 { label: 'Fixed 2750(AT)', type: 'checkbox', enabled: !box.isRunning(),219 checked: cpuCycles === 'fixed 2750',220 click: () => app.saveConf('cpu', 'cycles', 'fixed 2750') },221 { label: 'Fixed 315(XT)', type: 'checkbox', enabled: !box.isRunning(),222 checked: cpuCycles === 'fixed 315',223 click: () => app.saveConf('cpu', 'cycles', 'fixed 315') },224 { type: 'separator' },225 {226 label: 'Memory Size', submenu: [227 { label: '32 MB', type: 'checkbox', enabled: !box.isRunning(),228 checked: memSize === '31',229 click: () => app.saveConf('dosbox', 'memsize', '31') },230 { type: 'separator' },231 { label: '64 MB', type: 'checkbox', enabled: !box.isRunning(),232 checked: memSize === '63',233 click: () => app.saveConf('dosbox', 'memsize', '63') },234 { label: '16 MB', type: 'checkbox', enabled: !box.isRunning(),235 checked: memSize === '16',236 click: () => app.saveConf('dosbox', 'memsize', '16') }237 ]238 },239 { type: 'separator' },240 { label: 'Extended Memory(XMS)', type: 'checkbox', enabled: !box.isRunning(),241 checked: memXMS, click: () => app.saveConf('dos', 'xms', memXMS = !memXMS) },242 { label: 'Expanded Memory(EMS)', type: 'checkbox', enabled: !box.isRunning(),243 checked: memEMS, click: () => app.saveConf('dos', 'ems', memEMS = !memEMS) },244 { label: 'Upper Memory Block(UMB)', type: 'checkbox', enabled: !box.isRunning(),245 checked: memUMB, click: () => app.saveConf('dos', 'umb', memUMB = !memUMB) },246 { type: 'separator' },247 { label: 'Graphic', submenu: [248 { label: 'SVGA', type: 'checkbox', enabled: !box.isRunning(),249 checked: machine === 'svga_s3',250 click: () => app.saveConf('dosbox', 'machine', 'svga_s3') },251 { type: 'separator' },252 { label: 'VESA(1.3)', type: 'checkbox', enabled: !box.isRunning(),253 checked: machine === 'vesa_oldvbe',254 click: () => app.saveConf('dosbox', 'machine', 'vesa_oldvbe') },255 { label: 'VESA(NO-LFB)', type: 'checkbox', enabled: !box.isRunning(),256 checked: machine === 'vesa_nolfb',257 click: () => app.saveConf('dosbox', 'machine', 'vesa_nolfb') },258 { label: 'SVGA Paradise', type: 'checkbox', enabled: !box.isRunning(),259 checked: machine === 'svga_paradise',260 click: () => app.saveConf('dosbox', 'machine', 'svga_paradise') },261 { label: 'SVGA ET4000', type: 'checkbox', enabled: !box.isRunning(),262 checked: machine === 'svga_et4000',263 click: () => app.saveConf('dosbox', 'machine', 'svga_et4000') },264 { label: 'SVGA ET3000', type: 'checkbox', enabled: !box.isRunning(),265 checked: machine === 'svga_et3000',266 click: () => app.saveConf('dosbox', 'machine', 'svga_et3000') },267 { type: 'separator' },268 { label: 'VGA(256 Colors)', type: 'checkbox', enabled: !box.isRunning(),269 checked: machine === 'vgaonly',270 click: () => app.saveConf('dosbox', 'machine', 'vgaonly') },271 { label: 'EGA(16 Colors)', type: 'checkbox', enabled: !box.isRunning(),272 checked: machine === 'ega',273 click: () => app.saveConf('dosbox', 'machine', 'ega') },274 { label: 'PCjr(16 Colors)', type: 'checkbox', enabled: !box.isRunning(),275 checked: machine === 'pcjr',276 click: () => app.saveConf('dosbox', 'machine', 'pcjr') },277 { label: 'Tandy(16 Colors)', type: 'checkbox', enabled: !box.isRunning(),278 checked: machine === 'tandy',279 click: () => app.saveConf('dosbox', 'machine', 'tandy') },280 { label: 'CGA(4 Colors)', type: 'checkbox', enabled: !box.isRunning(),281 checked: machine === 'cga',282 click: () => app.saveConf('dosbox', 'machine', 'cga') },283 { label: 'Hercules(2 Colors)', type: 'checkbox', enabled: !box.isRunning(),284 checked: machine === 'hercules',285 click: () => app.saveConf('dosbox', 'machine', 'hercules') }286 ] },287 { type: 'separator' },288 { label: 'Sound', submenu: [289 { label: 'MIDI', submenu: [290 { label: 'MPU-401', submenu: [291 { label: 'Intelligent', type: 'checkbox', enabled: !box.isRunning(),292 checked: mpu401 === 'intelligent',293 click: () => updateMenu('midi', 'mpu401', 'intelligent') },294 { type: 'separator' },295 { label: 'UART', type: 'checkbox', enabled: !box.isRunning(),296 checked: mpu401 === 'uart',297 click: () => updateMenu('midi', 'mpu401', 'uart') },298 { label: 'None', type: 'checkbox', enabled: !box.isRunning(),299 checked: mpu401 === 'none',300 click: () => updateMenu('midi', 'mpu401', 'none') }301 ] },302 { type: 'separator' },303 { label: 'Default System MIDI', type: 'checkbox', enabled: !box.isRunning(),304 checked: mididevice === 'default',305 click: () => updateMenu('midi', 'device', 'default') },306 { label: 'Win32 MIDI Playback', type: 'checkbox', enabled: !box.isRunning(),307 checked: mididevice === 'win32',308 click: () => updateMenu('midi', 'device', 'win32') },309 { label: 'Advanced Linux Sound', type: 'checkbox', enabled: !box.isRunning(),310 checked: mididevice === 'alsa',311 click: () => updateMenu('midi', 'device', 'alsa') },312 { label: 'Open Sound System', type: 'checkbox', enabled: !box.isRunning(),313 checked: mididevice === 'oss',314 click: () => updateMenu('midi', 'device', 'oss') },315 { label: 'OS X Synthesizer', type: 'checkbox', enabled: !box.isRunning(),316 checked: mididevice === 'coreaudio',317 click: () => updateMenu('midi', 'device', 'coreaudio') },318 { label: 'OS X Audio MIDI', type: 'checkbox', enabled: !box.isRunning(),319 checked: mididevice === 'coremidi',320 click: () => updateMenu('midi', 'device', 'coremidi') },321 { label: 'None', type: 'checkbox', enabled: !box.isRunning(),322 checked: mididevice === 'none',323 click: () => updateMenu('midi', 'device', 'none') }324 ] },325 { label: 'Sound Blaster', submenu: [326 { label: 'Type', submenu: [327 { label: 'Sound Blaster 16', type: 'checkbox', enabled: !box.isRunning(),328 checked: sbtype === 'sb16',329 click: () => updateMenu('sblaster', 'sbtype', 'sb16') },330 { type: 'separator' },331 { label: 'Sound Blaster Pro 2', type: 'checkbox', enabled: !box.isRunning(),332 checked: sbtype === 'sbpro2',333 click: () => updateMenu('sblaster', 'sbtype', 'sbpro2') },334 { label: 'Sound Blaster Pro 1', type: 'checkbox', enabled: !box.isRunning(),335 checked: sbtype === 'sbpro1',336 click: () => updateMenu('sblaster', 'sbtype', 'sbpro1') },337 { label: 'Sound Blaster 2', type: 'checkbox', enabled: !box.isRunning(),338 checked: sbtype === 'sb2',339 click: () => updateMenu('sblaster', 'sbtype', 'sb2') },340 { label: 'Sound Blaster 1', type: 'checkbox', enabled: !box.isRunning(),341 checked: sbtype === 'sb1',342 click: () => updateMenu('sblaster', 'sbtype', 'sb1') },343 { label: 'None', type: 'checkbox', enabled: !box.isRunning(),344 checked: sbtype === 'none',345 click: () => updateMenu('sblaster', 'sbtype', 'none') }346 ] },347 { type: 'separator' },348 { label: `Base [${sbbase}]`, submenu: [349 { label: '220', type: 'checkbox', enabled: !box.isRunning(),350 checked: sbbase === '220',351 click: () => updateMenu('sblaster', 'sbbase', '220') },352 { type: 'separator' },353 { label: '240', type: 'checkbox', enabled: !box.isRunning(),354 checked: sbbase === '240',355 click: () => updateMenu('sblaster', 'sbbase', '240') },356 { label: '260', type: 'checkbox', enabled: !box.isRunning(),357 checked: sbbase === '260',358 click: () => updateMenu('sblaster', 'sbbase', '260') },359 { label: '280', type: 'checkbox', enabled: !box.isRunning(),360 checked: sbbase === '280',361 click: () => updateMenu('sblaster', 'sbbase', '280') },362 { label: '2a0', type: 'checkbox', enabled: !box.isRunning(),363 checked: sbbase === '2a0',364 click: () => updateMenu('sblaster', 'sbbase', '2a0') },365 { label: '2c0', type: 'checkbox', enabled: !box.isRunning(),366 checked: sbbase === '2c0',367 click: () => updateMenu('sblaster', 'sbbase', '2c0') },368 { label: '2e0', type: 'checkbox', enabled: !box.isRunning(),369 checked: sbbase === '2e0',370 click: () => updateMenu('sblaster', 'sbbase', '2e0') },371 { label: '300', type: 'checkbox', enabled: !box.isRunning(),372 checked: sbbase === '300',373 click: () => updateMenu('sblaster', 'sbbase', '300') }374 ] },375 { label: `IRQ [${sbirq}]`, submenu: [376 { label: '7', type: 'checkbox', enabled: !box.isRunning(),377 checked: sbirq === '7',378 click: () => updateMenu('sblaster', 'irq', '7') },379 { type: 'separator' },380 { label: '5', type: 'checkbox', enabled: !box.isRunning(),381 checked: sbirq === '5',382 click: () => updateMenu('sblaster', 'irq', '5') },383 { label: '3', type: 'checkbox', enabled: !box.isRunning(),384 checked: sbirq === '3',385 click: () => updateMenu('sblaster', 'irq', '3') },386 { label: '9', type: 'checkbox', enabled: !box.isRunning(),387 checked: sbirq === '9',388 click: () => updateMenu('sblaster', 'irq', '9') },389 { label: '10', type: 'checkbox', enabled: !box.isRunning(),390 checked: sbirq === '10',391 click: () => updateMenu('sblaster', 'irq', '10') },392 { label: '11', type: 'checkbox', enabled: !box.isRunning(),393 checked: sbirq === '11',394 click: () => updateMenu('sblaster', 'irq', '11') },395 { label: '12', type: 'checkbox', enabled: !box.isRunning(),396 checked: sbirq === '12',397 click: () => updateMenu('sblaster', 'irq', '12') }398 ] },399 { label: `DMB [${sbdma}]`, submenu: [400 { label: '1', type: 'checkbox', enabled: !box.isRunning(),401 checked: sbdma === '1',402 click: () => updateMenu('sblaster', 'dma', '1') },403 { type: 'separator' },404 { label: '5', type: 'checkbox', enabled: !box.isRunning(),405 checked: sbdma === '5',406 click: () => updateMenu('sblaster', 'dma', '5') },407 { label: '0', type: 'checkbox', enabled: !box.isRunning(),408 checked: sbdma === '0',409 click: () => updateMenu('sblaster', 'dma', '0') },410 { label: '3', type: 'checkbox', enabled: !box.isRunning(),411 checked: sbdma === '3',412 click: () => updateMenu('sblaster', 'dma', '3') },413 { label: '6', type: 'checkbox', enabled: !box.isRunning(),414 checked: sbdma === '6',415 click: () => updateMenu('sblaster', 'dma', '6') },416 { label: '7', type: 'checkbox', enabled: !box.isRunning(),417 checked: sbdma === '7',418 click: () => updateMenu('sblaster', 'dma', '7') }419 ] },420 { label: `HDMA [${sbhdma}]`, submenu: [421 { label: '1', type: 'checkbox', enabled: !box.isRunning(),422 checked: sbhdma === '1',423 click: () => updateMenu('sblaster', 'hdma', '1') },424 { type: 'separator' },425 { label: '5', type: 'checkbox', enabled: !box.isRunning(),426 checked: sbhdma === '5',427 click: () => updateMenu('sblaster', 'hdma', '5') },428 { label: '0', type: 'checkbox', enabled: !box.isRunning(),429 checked: sbhdma === '0',430 click: () => updateMenu('sblaster', 'hdma', '0') },431 { label: '3', type: 'checkbox', enabled: !box.isRunning(),432 checked: sbhdma === '3',433 click: () => updateMenu('sblaster', 'hdma', '3') },434 { label: '6', type: 'checkbox', enabled: !box.isRunning(),435 checked: sbhdma === '6',436 click: () => updateMenu('sblaster', 'hdma', '6') },437 { label: '7', type: 'checkbox', enabled: !box.isRunning(),438 checked: sbhdma === '7',439 click: () => updateMenu('sblaster', 'hdma', '7') }440 ] },441 { type: 'separator' },442 { label: `OPL Mode`, submenu: [443 { label: 'auto', type: 'checkbox', enabled: !box.isRunning(),444 checked: sboplmode === 'auto',445 click: () => updateMenu('sblaster', 'oplmode', 'auto') },446 { type: 'separator' },447 { label: 'CMS', type: 'checkbox', enabled: !box.isRunning(),448 checked: sboplmode === 'cms',449 click: () => updateMenu('sblaster', 'oplmode', 'cms') },450 { label: 'OPL-2', type: 'checkbox', enabled: !box.isRunning(),451 checked: sboplmode === 'opl2',452 click: () => updateMenu('sblaster', 'oplmode', 'opl2') },453 { label: 'Dule OPL-2', type: 'checkbox', enabled: !box.isRunning(),454 checked: sboplmode === 'dualopl2',455 click: () => updateMenu('sblaster', 'oplmode', 'dualopl2') },456 { label: 'OPL-3', type: 'checkbox', enabled: !box.isRunning(),457 checked: sboplmode === 'opl3',458 click: () => updateMenu('sblaster', 'oplmode', 'opl3') },459 { label: 'None', type: 'checkbox', enabled: !box.isRunning(),460 checked: sboplmode === 'none',461 click: () => updateMenu('sblaster', 'oplmode', 'none') }462 ] },463 { label: `OPL Emulation`, submenu: [464 { label: 'default', type: 'checkbox', enabled: !box.isRunning(),465 checked: sboplemu === 'default',466 click: () => updateMenu('sblaster', 'oplemu', 'default') },467 { type: 'separator' },468 { label: 'Compat', type: 'checkbox', enabled: !box.isRunning(),469 checked: sboplemu === 'compat',470 click: () => updateMenu('sblaster', 'oplemu', 'compat') },471 { label: 'Fast', type: 'checkbox', enabled: !box.isRunning(),472 checked: sboplemu === 'fast',473 click: () => updateMenu('sblaster', 'oplemu', 'fast') },474 { label: 'Old', type: 'checkbox', enabled: !box.isRunning(),475 checked: sboplemu === 'old',476 click: () => updateMenu('sblaster', 'oplemu', 'old') }477 ] },478 { type: 'separator' },479 { label: 'Use Mixer', type: 'checkbox', enabled: !box.isRunning(),480 checked: sbmixer,481 click: () => app.saveConf('sblaster', 'mixer', sbmixer = !sbmixer) }482 ] },483 { label: 'Gravis Ultra Sound', submenu: [484 { label: 'Enabled', type: 'checkbox', enabled: !box.isRunning(),485 checked: gus,486 click: () => app.saveConf('gus', 'gus', gus = !gus) },487 { type: 'separator' },488 { label: `Base [${gusbase}]`, submenu: [489 { label: '220', type: 'checkbox', enabled: !box.isRunning(),490 checked: gusbase === '220',491 click: () => updateMenu('gus', 'gusbase', '220') },492 { type: 'separator' },493 { label: '240', type: 'checkbox', enabled: !box.isRunning(),494 checked: gusbase === '240',495 click: () => updateMenu('gus', 'gusbase', '240') },496 { label: '260', type: 'checkbox', enabled: !box.isRunning(),497 checked: gusbase === '260',498 click: () => updateMenu('gus', 'gusbase', '260') },499 { label: '280', type: 'checkbox', enabled: !box.isRunning(),500 checked: gusbase === '280',501 click: () => updateMenu('gus', 'gusbase', '280') },502 { label: '2a0', type: 'checkbox', enabled: !box.isRunning(),503 checked: gusbase === '2a0',504 click: () => updateMenu('gus', 'gusbase', '2a0') },505 { label: '2c0', type: 'checkbox', enabled: !box.isRunning(),506 checked: gusbase === '2c0',507 click: () => updateMenu('gus', 'gusbase', '2c0') },508 { label: '2e0', type: 'checkbox', enabled: !box.isRunning(),509 checked: gusbase === '2e0',510 click: () => updateMenu('gus', 'gusbase', '2e0') },511 { label: '300', type: 'checkbox', enabled: !box.isRunning(),512 checked: gusbase === '300',513 click: () => updateMenu('gus', 'gusbase', '300') }514 ] },515 { label: `IRQ [${gusirq}]`, submenu: [516 { label: '5', type: 'checkbox', enabled: !box.isRunning(),517 checked: gusirq === '5',518 click: () => updateMenu('gus', 'irq2', '5') },519 { type: 'separator' },520 { label: '3', type: 'checkbox', enabled: !box.isRunning(),521 checked: gusirq === '3',522 click: () => updateMenu('gus', 'irq2', '3') },523 { label: '7', type: 'checkbox', enabled: !box.isRunning(),524 checked: gusirq === '7',525 click: () => updateMenu('gus', 'irq2', '7') },526 { label: '9', type: 'checkbox', enabled: !box.isRunning(),527 checked: gusirq === '9',528 click: () => updateMenu('gus', 'irq2', '9') },529 { label: '10', type: 'checkbox', enabled: !box.isRunning(),530 checked: gusirq === '10',531 click: () => updateMenu('gus', 'irq2', '10') },532 { label: '11', type: 'checkbox', enabled: !box.isRunning(),533 checked: gusirq === '11',534 click: () => updateMenu('gus', 'irq2', '11') },535 { label: '12', type: 'checkbox', enabled: !box.isRunning(),536 checked: gusirq === '12',537 click: () => updateMenu('gus', 'irq2', '12') }538 ] },539 { label: `DMA [${gusdma}]`, submenu: [540 { label: '3', type: 'checkbox', enabled: !box.isRunning(),541 checked: gusdma === '3',542 click: () => updateMenu('gus', 'dma2', '3') },543 { type: 'separator' },544 { label: '0', type: 'checkbox', enabled: !box.isRunning(),545 checked: gusdma === '0',546 click: () => updateMenu('gus', 'dma2', '0') },547 { label: '1', type: 'checkbox', enabled: !box.isRunning(),548 checked: gusdma === '1',549 click: () => updateMenu('gus', 'dma2', '1') },550 { label: '5', type: 'checkbox', enabled: !box.isRunning(),551 checked: gusdma === '5',552 click: () => updateMenu('gus', 'dma2', '5') },553 { label: '6', type: 'checkbox', enabled: !box.isRunning(),554 checked: gusdma === '6',555 click: () => updateMenu('gus', 'dma2', '6') },556 { label: '7', type: 'checkbox', enabled: !box.isRunning(),557 checked: gusdma === '7',558 click: () => updateMenu('gus', 'dma2', '7') }559 ] }560 ] },561 { label: 'PC Speaker', submenu: [562 { label: 'Enabled', type: 'checkbox', enabled: !box.isRunning(),563 checked: pcspeaker,564 click: () => app.saveConf('speaker', 'pcspeaker', pcspeaker = !pcspeaker) },565 { type: 'separator' },566 { label: 'Tandy Sound', submenu: [567 { label: 'Auto', type: 'checkbox', enabled: !box.isRunning(),568 checked: tandy === 'auto',569 click: () => updateMenu('speaker', 'tandy', 'auto') },570 { type: 'separator' },571 { label: 'On', type: 'checkbox', enabled: !box.isRunning(),572 checked: tandy === 'on',573 click: () => updateMenu('speaker', 'tandy', 'on') },574 { label: 'Off', type: 'checkbox', enabled: !box.isRunning(),575 checked: tandy === 'off',576 click: () => updateMenu('speaker', 'tandy', 'off') }577 ] },578 { label: 'Disney Sound', type: 'checkbox', enabled: !box.isRunning(),579 checked: disney,580 click: () => app.saveConf('speaker', 'memsize', disney = !disney) }581 ] },582 { type: 'separator' },583 { label: 'Sample Rate 49.7 KHz', type: 'checkbox', enabled: !box.isRunning(),584 checked: sndRate === '49716', click: () => changeSempleRate('49716') },585 { label: 'Sample Rate 48 KHz', type: 'checkbox', enabled: !box.isRunning(),586 checked: sndRate === '48000', click: () => changeSempleRate('48000') },587 { label: 'Sample Rate 44.1 KHz', type: 'checkbox', enabled: !box.isRunning(),588 checked: sndRate === '44100', click: () => changeSempleRate('44100') },589 { label: 'Sample Rate 32 KHz', type: 'checkbox', enabled: !box.isRunning(),590 checked: sndRate === '32000', click: () => changeSempleRate('32000') },591 { label: 'Sample Rate 22 KHz', type: 'checkbox', enabled: !box.isRunning(),592 checked: sndRate === '22050', click: () => changeSempleRate('22050') },593 { label: 'Sample Rate 16 KHz', type: 'checkbox', enabled: !box.isRunning(),594 checked: sndRate === '16000', click: () => changeSempleRate('16000') },595 { label: 'Sample Rate 11 KHz', type: 'checkbox', enabled: !box.isRunning(),596 checked: sndRate === '11025', click: () => changeSempleRate('11025') },597 { label: 'Sample Rate 8 KHz', type: 'checkbox', enabled: !box.isRunning(),598 checked: sndRate === '8000', click: () => changeSempleRate('8000') }599 ] },600 { type: 'separator' },601 { label: 'Joystick', submenu: [602 { label: 'Type', submenu: [603 { label: 'Auto', type: 'checkbox', enabled: !box.isRunning(),604 checked: joysticktype === 'auto',605 click: () => updateMenu('joystick', 'joysticktype', 'auto') },606 { type: 'separator' },607 { label: '2 Axis', type: 'checkbox', enabled: !box.isRunning(),608 checked: joysticktype === '2axis',609 click: () => updateMenu('joystick', 'joysticktype', '2axis') },610 { label: 'First 4 Axis', type: 'checkbox', enabled: !box.isRunning(),611 checked: joysticktype === '4axis',612 click: () => updateMenu('joystick', 'joysticktype', '4axis') },613 { label: 'Second 4 Axis', type: 'checkbox', enabled: !box.isRunning(),614 checked: joysticktype === '4axis_2',615 click: () => updateMenu('joystick', 'joysticktype', '4axis_2') },616 { label: 'Flight Stick', type: 'checkbox', enabled: !box.isRunning(),617 checked: joysticktype === 'fcs',618 click: () => updateMenu('joystick', 'joysticktype', 'fcs') },619 { label: 'None', type: 'checkbox', enabled: !box.isRunning(),620 checked: joysticktype === 'none',621 click: () => updateMenu('joystick', 'joysticktype', 'none') }622 ] },623 { type: 'separator' },624 { label: 'Timed Interval', type: 'checkbox', enabled: !box.isRunning(),625 checked: joytimed,626 click: () => app.saveConf('joystick', 'timed', joytimed = !joytimed) },627 { label: 'Auto Fire', type: 'checkbox', enabled: !box.isRunning(),628 checked: joyautofire,629 click: () => app.saveConf('joystick', 'autofire', joyautofire = !joyautofire) },630 { label: 'Swap 3rd 4th Axis', type: 'checkbox', enabled: !box.isRunning(),631 checked: joyswap34,632 click: () => app.saveConf('joystick', 'swap34', joyswap34 = !joyswap34) },633 { label: 'Button Wrapping', type: 'checkbox', enabled: !box.isRunning(),634 checked: joybuttonwrap,635 click: () => app.saveConf('joystick', 'buttonwrap', joybuttonwrap = !joybuttonwrap) }636 ] }637 ]638 },639 {640 label: 'Help', role: 'help', submenu: [641 { label: 'Homepage', click: () => shell.openExternal(app, pack.homepage) },642 { label: 'Documentation', click: () => shell.openExternal(pack.bugs.url) },643 { label: 'Bug Report', click: () => shell.openExternal(pack.repository.url) }644 ]645 }646 ];647 if (isDarwin) {...

Full Screen

Full Screen

networktester_test.js

Source:networktester_test.js Github

copy

Full Screen

...27function testSuccess() {28 // set up the tster29 var handler = new Handler();30 var tester = new goog.net.NetworkTester(handler.callback, handler);31 assertFalse(tester.isRunning());32 tester.start();33 assertTrue(handler.isEmpty());34 assertTrue(tester.isRunning());35 // simulate the image load and verify36 var image = tester.image_;37 assertEquals(String(tester.getUri()), image.src);38 assertTrue(handler.isEmpty());39 image.onload.call(null);40 assertTrue(handler.dequeue());41 assertFalse(tester.isRunning());42}43function testFailure() {44 // set up the tester45 var handler = new Handler();46 var tester = new goog.net.NetworkTester(handler.callback, handler);47 assertFalse(tester.isRunning());48 tester.start();49 assertTrue(handler.isEmpty());50 assertTrue(tester.isRunning());51 // simulate the image failure and verify52 var image = tester.image_;53 assertEquals(String(tester.getUri()), image.src);54 assertTrue(handler.isEmpty());55 image.onerror.call(null);56 assertFalse(handler.dequeue());57 assertFalse(tester.isRunning());58}59function testAbort() {60 // set up the tester61 var handler = new Handler();62 var tester = new goog.net.NetworkTester(handler.callback, handler);63 assertFalse(tester.isRunning());64 tester.start();65 assertTrue(handler.isEmpty());66 assertTrue(tester.isRunning());67 // simulate the image abort and verify68 var image = tester.image_;69 assertEquals(String(tester.getUri()), image.src);70 assertTrue(handler.isEmpty());71 image.onabort.call(null);72 assertFalse(handler.dequeue());73 assertFalse(tester.isRunning());74}75function testTimeout() {76 // set up the tester77 var handler = new Handler();78 var tester = new goog.net.NetworkTester(handler.callback, handler);79 assertFalse(tester.isRunning());80 tester.start();81 assertTrue(handler.isEmpty());82 assertTrue(tester.isRunning());83 // simulate the image timeout and verify84 var image = tester.image_;85 assertEquals(String(tester.getUri()), image.src);86 assertTrue(handler.isEmpty());87 clock.tick(10000);88 assertFalse(handler.dequeue());89 assertFalse(tester.isRunning());90}91function testRetries() {92 // set up the tester93 var handler = new Handler();94 var tester = new goog.net.NetworkTester(handler.callback, handler);95 tester.setNumRetries(1);96 assertEquals(tester.getAttemptCount(), 0);97 assertFalse(tester.isRunning());98 tester.start();99 assertTrue(handler.isEmpty());100 assertTrue(tester.isRunning());101 assertEquals(tester.getAttemptCount(), 1);102 // try number 1 fails103 var image = tester.image_;104 assertEquals(String(tester.getUri()), image.src);105 assertTrue(handler.isEmpty());106 image.onerror.call(null);107 assertTrue(handler.isEmpty());108 assertTrue(tester.isRunning());109 assertEquals(tester.getAttemptCount(), 2);110 // try number 2 succeeds111 image = tester.image_;112 assertEquals(String(tester.getUri()), image.src);113 assertTrue(handler.isEmpty());114 image.onload.call(null);115 assertTrue(handler.dequeue());116 assertFalse(tester.isRunning());117 assertEquals(tester.getAttemptCount(), 2);118}119function testPauseBetweenRetries() {120 // set up the tester121 var handler = new Handler();122 var tester = new goog.net.NetworkTester(handler.callback, handler);123 tester.setNumRetries(1);124 tester.setPauseBetweenRetries(1000);125 assertFalse(tester.isRunning());126 tester.start();127 assertTrue(handler.isEmpty());128 assertTrue(tester.isRunning());129 // try number 1 fails130 var image = tester.image_;131 assertEquals(String(tester.getUri()), image.src);132 assertTrue(handler.isEmpty());133 image.onerror.call(null);134 assertTrue(handler.isEmpty());135 assertTrue(tester.isRunning());136 // need to pause 1000 ms for the second attempt137 assertNull(tester.image_);138 clock.tick(1000);139 // try number 2 succeeds140 image = tester.image_;141 assertEquals(String(tester.getUri()), image.src);142 assertTrue(handler.isEmpty());143 image.onload.call(null);144 assertTrue(handler.dequeue());145 assertFalse(tester.isRunning());146}147function testNonDefaultUri() {148 var handler = new Handler();149 var newUri = new goog.Uri('//www.google.com/images/cleardot2.gif');150 var tester = new goog.net.NetworkTester(handler.callback, handler, newUri);151 var testerUri = tester.getUri();152 assertTrue(testerUri.toString().indexOf('cleardot2') > -1);153}154function testOffline() {155 // set up the tester156 var handler = new Handler();157 var tester = new goog.net.NetworkTester(handler.callback, handler);158 var orgGetNavigatorOffline = goog.net.NetworkTester.getNavigatorOffline_;159 goog.net.NetworkTester.getNavigatorOffline_ = function() {160 return true;161 };162 try {163 assertFalse(tester.isRunning());164 tester.start();165 assertTrue(handler.isEmpty());166 assertTrue(tester.isRunning());167 // the call is done async168 clock.tick(1);169 assertFalse(handler.dequeue());170 assertFalse(tester.isRunning());171 } finally {172 // Clean up!173 goog.net.NetworkTester.getNavigatorOffline_ = orgGetNavigatorOffline;174 }175}176// Handler object for verifying callback177function Handler() {178 this.events_ = [];179}180function testGetAttemptCount() {181 // set up the tester182 var handler = new Handler();183 var tester = new goog.net.NetworkTester(handler.callback, handler);184 assertEquals(tester.getAttemptCount(), 0);185 assertTrue(tester.attempt_ === tester.getAttemptCount());186 assertFalse(tester.isRunning());187 tester.start();188 assertTrue(tester.isRunning());189 assertTrue(tester.attempt_ === tester.getAttemptCount());190}191Handler.prototype.callback = function(result) {192 this.events_.push(result);193};194Handler.prototype.isEmpty = function() {195 return this.events_.length == 0;196};197Handler.prototype.dequeue = function() {198 if (this.isEmpty()) {199 throw Error('Handler is empty');200 }201 return this.events_.shift();202};...

Full Screen

Full Screen

Stopwatch.js

Source:Stopwatch.js Github

copy

Full Screen

1// Lesson 12/*3import React, { Component } from 'react';4class Stopwatch extends Component {5 render() {6 return (7 <div className='stopwatch'>8 <h2>Stopwatch</h2>9 <span className='stopwatch-time'>0</span>10 <button>Start</button>11 <button>Reset</button>12 </div>13 );14 }15}16export default Stopwatch;17// Lesson 218import React, { Component } from 'react';19class Stopwatch extends Component {20 state = {21 isRunning: false,22 };23 handleStopwatch = () => {24 this.setState({25 isRunning: !this.state.isRunning,26 });27 };28 render() {29 return (30 <div className='stopwatch'>31 <h2>Stopwatch</h2>32 <span className='stopwatch-time'>0</span>33 <button onClick={this.handleStopwatch}>34 {this.state.isRunning ? 'Stop' : 'Start'}35 </button>36 <button>Reset</button>37 </div>38 );39 }40}41export default Stopwatch;42// Lesson 343import React, { Component } from 'react';44class Stopwatch extends Component {45 state = {46 isRunning: false,47 elapsedTime: 0,48 previousTime: 0,49 };50 componentDidMount() {51 this.intervalID = setInterval(() => this.tick(), 100);52 }53 tick = () => {54 if (this.state.isRunning) {55 const now = Date.now();56 this.setState((prevState) => ({57 previousTime: now,58 elapsedTime: prevState.elapsedTime + (now - this.state.previousTime),59 }));60 }61 };62 handleStopwatch = () => {63 this.setState((prevState) => ({64 isRunning: !prevState.isRunning,65 }));66 if (!this.state.isRunning) {67 this.setState({ previousTime: Date.now() });68 }69 };70 render() {71 return (72 <div className='stopwatch'>73 <h2>Stopwatch</h2>74 <span className='stopwatch-time'>0</span>75 <button onClick={this.handleStopwatch}>76 {this.state.isRunning ? 'Stop' : 'Start'}77 </button>78 <button>Reset</button>79 </div>80 );81 }82}83export default Stopwatch;84// Lesson 485import React, { Component } from 'react';86class Stopwatch extends Component {87 state = {88 isRunning: false,89 elapsedTime: 0,90 previousTime: 0,91 };92 componentDidMount() {93 this.intervalID = setInterval(() => this.tick(), 100);94 }95 tick = () => {96 if (this.state.isRunning) {97 const now = Date.now();98 this.setState((prevState) => ({99 previousTime: now,100 elapsedTime: prevState.elapsedTime + (now - this.state.previousTime),101 }));102 }103 };104 handleStopwatch = () => {105 this.setState((prevState) => ({106 isRunning: !prevState.isRunning,107 }));108 if (!this.state.isRunning) {109 this.setState({ previousTime: Date.now() });110 }111 };112 handleReset = () => {113 this.setState({ elapsedTime: 0 });114 };115 render() {116 // floor is an interga117 const seconds = Math.floor(this.state.elapsedTime / 1000);118 return (119 <div className='stopwatch'>120 <h2>Stopwatch</h2>121 <span className='stopwatch-time'>{seconds}</span>122 <button onClick={this.handleStopwatch}>123 {this.state.isRunning ? 'Stop' : 'Start'}124 </button>125 <button onClick={this.handleReset}>Reset</button>126 </div>127 );128 }129}130export default Stopwatch;131*/132// Lesson 5133import React, { Component } from 'react';134class Stopwatch extends Component {135 state = {136 isRunning: false,137 elapsedTime: 0,138 previousTime: 0,139 };140 componentDidMount() {141 this.intervalID = setInterval(() => this.tick(), 100);142 }143 componentWillUnmount() {144 clearInterval(this.intervalID);145 }146 tick = () => {147 if (this.state.isRunning) {148 const now = Date.now();149 this.setState((prevState) => ({150 previousTime: now,151 elapsedTime: prevState.elapsedTime + (now - this.state.previousTime),152 }));153 }154 };155 handleStopwatch = () => {156 this.setState((prevState) => ({157 isRunning: !prevState.isRunning,158 }));159 if (!this.state.isRunning) {160 this.setState({ previousTime: Date.now() });161 }162 };163 handleReset = () => {164 this.setState({ elapsedTime: 0 });165 };166 render() {167 const seconds = Math.floor(this.state.elapsedTime / 1000);168 return (169 <div className='stopwatch'>170 <h2>Stopwatch</h2>171 <span className='stopwatch-time'>{seconds}</span>172 <button onClick={this.handleStopwatch}>173 {this.state.isRunning ? 'Stop' : 'Start'}174 </button>175 <button onClick={this.handleReset}>Reset</button>176 </div>177 );178 }179}...

Full Screen

Full Screen

PomodoroTimer.js

Source:PomodoroTimer.js Github

copy

Full Screen

1import React from 'react';2import { Button, StyleSheet, Text, View } from 'react-native';3import {4 Countdown,5 TimeInput,6 Timer,7 TimerToggleButton,8 vibrate,9} from './components';10//import {Timer, vibrate} from './utils'11const DEFAULT_WORK_MINS = 25;12const DEFAULT_BREAK_MINS = 5;13const minToSec = mins => mins * 60;14const nextTimer = { work: 'break', break: 'work' };15export default class App extends React.Component {16 state = {17 // in seconds18 workTime: minToSec(DEFAULT_WORK_MINS),19 breakTime: minToSec(DEFAULT_BREAK_MINS),20 // in ms21 timeRemaining: minToSec(DEFAULT_WORK_MINS) * 1000,22 isRunning: false,23 activeTimer: 'work',24 };25 componentDidMount() {26 this.timer = new Timer(27 this.state.timeRemaining,28 this.updateTimeRemaining,29 this.handleTimerEnd30 );31 this.isRunning = this.timer.isRunning;32 //this.setState({isRunning: this.timer.isRunning})33 }34 componentWillUnmount() {35 if (this.timer) this.timer.stop();36 }37 updateTime = target => (time, shouldStartTimer) => {38 if (this.state.activeTimer === target) {39 if (this.timer) this.timer.stop();40 const timeRemaining = +time * 1000;41 this.timer = new Timer(42 timeRemaining,43 this.updateTimeRemaining,44 this.handleTimerEnd45 );46 if (!shouldStartTimer) this.timer.stop();47 this.setState({48 [`${target}Time`]: time,49 timeRemaining,50 isRunning: this.timer.isRunning,51 });52 } else {53 this.setState({54 [`${target}Time`]: time,55 isRunning: this.timer.isRunning,56 });57 }58 };59 // hack: if an event is passed (ie is button press), stop timer60 resetTimer = shouldStopTimer => {61 const { activeTimer } = this.state;62 this.updateTime(activeTimer)(63 this.state[`${activeTimer}Time`],64 !shouldStopTimer65 );66 };67 updateTimeRemaining = timeRemaining => {68 this.setState({ timeRemaining });69 };70 toggleTimer = () => {71 if (!this.timer) return;72 if (this.timer.isRunning) this.timer.stop();73 else this.timer.start();74 this.setState({ isRunning: this.timer.isRunning });75 };76 handleTimerEnd = () => {77 vibrate();78 this.setState(79 prevState => ({ activeTimer: nextTimer[prevState.activeTimer] }),80 this.resetTimer81 );82 };83 render() {84 return (85 <View style={styles.container}>86 <Text style={[styles.title, styles.center]}>87 {this.state.activeTimer.toUpperCase()} TIMER88 </Text>89 <Countdown90 style={styles.center}91 timeRemaining={this.state.timeRemaining}92 onToggleTimer={this.toggleTimer}93 />94 <View style={[styles.buttonGroup, styles.center]}>95 <TimerToggleButton96 onToggle={this.toggleTimer}97 isRunning={this.state.isRunning}98 />99 <Button title="Reset" onPress={this.resetTimer} />100 </View>101 <TimeInput102 title="Work Time:"103 onChange={this.updateTime('work')}104 value={this.state.workTime}105 />106 <TimeInput107 title="Break Time:"108 onChange={this.updateTime('break')}109 value={this.state.breakTime}110 />111 </View>112 );113 }114}115const styles = StyleSheet.create({116 container: {117 flex: 1,118 paddingTop: 150,119 backgroundColor: '#fff',120 alignItems: 'stretch',121 },122 center: {123 alignSelf: 'center',124 },125 buttonGroup: {126 flexDirection: 'row',127 },128 title: {129 fontWeight: 'bold',130 fontSize: 48,131 textTransform: 'capitalize',132 },...

Full Screen

Full Screen

TimerService.js

Source:TimerService.js Github

copy

Full Screen

1angular2 .module('choregg')3 .factory('TimerService', ['$rootScope', '$q', function($rootScope, $q) {4 var timeRemaining = 10;5 var isRunning = null;6 var isPaused = null;7 return {8 getTimeRemaining: function() {9 // THIS IS ONLY USED IN TEST10 return timeRemaining;11 },12 getIsRunning: function() {13 // THIS IS ONLY USED IN TEST14 return isRunning;15 },16 getIsPaused: function() {17 // THIS IS ONLY USED IN TEST18 return isPaused;19 },20 pause: function() {21 $rootScope.$broadcast('timer-stop');22 isPaused = true;23 isRunning = false;24 $rootScope.$broadcast('isPausedChanged', {isPaused: isPaused});25 $rootScope.$broadcast('isRunningChanged', {isRunning: isRunning});26 },27 resume: function() {28 $rootScope.$broadcast('timer-start');29 isRunning = true;30 isPaused = false;31 $rootScope.$broadcast('isPausedChanged', {isPaused: isPaused});32 $rootScope.$broadcast('isRunningChanged', {isRunning: isRunning});33 },34 startTimer: function() {35 isRunning = true;36 isPaused = false;37 $rootScope.$broadcast('timer-start');38 $rootScope.$broadcast('isPausedChanged', {isPaused: isPaused});39 $rootScope.$broadcast('isRunningChanged', {isRunning: isRunning});40 },41 tickDown: function() {42 if (isRunning && !isPaused) {43 timeRemaining -= 1;44 $rootScope.$broadcast('timeRemainingChanged', {timeRemaining: timeRemaining});45 }46 },47 stopTimer: function () {48 $rootScope.$broadcast('timer-stop');49 isRunning = false;50 isPaused = false;51 $rootScope.$broadcast('isPausedChanged', {isPaused: isPaused});52 $rootScope.$broadcast('isRunningChanged', {isRunning: isRunning});53 },54 restartTimer: function() {55 $rootScope.$broadcast('timer-stop');56 $rootScope.$broadcast('timer-start');57 $rootScope.$broadcast('timer-set-countdown', 10);58 timeRemaining = 10;59 $rootScope.$broadcast('timeRemainingChanged', {timeRemaining: timeRemaining});60 isRunning = true;61 isPaused = false;62 $rootScope.$broadcast('isPausedChanged', {isPaused: isPaused});63 $rootScope.$broadcast('isRunningChanged', {isRunning: isRunning});64 }65 }...

Full Screen

Full Screen

Controls.js

Source:Controls.js Github

copy

Full Screen

1import React from "react";2import { useSelector, useDispatch } from "react-redux";3import { moveDown, moveLeft, moveRight, rotate } from "../actions";4export default function Controls(props) {5 const dispatch = useDispatch();6 const { isRunning, gameOver } = useSelector((state) => state.game);7 return (8 <div className={`controls`}>9 {/* left */}10 <button11 disabled={!isRunning || gameOver}12 className="control-button"13 onClick={(e) => {14 if (!isRunning || gameOver) {15 return;16 }17 dispatch(moveLeft());18 }}19 >Left</button>20 {/* right */}21 <button22 disabled={!isRunning || gameOver}23 className="control-button"24 onClick={(e) => {25 if (!isRunning || gameOver) {26 return;27 }28 dispatch(moveRight());29 }}30 >Right</button>31 {/* rotate */}32 <button33 disabled={!isRunning || gameOver}34 className="control-button"35 onClick={(e) => {36 if (!isRunning || gameOver) {37 return;38 }39 dispatch(rotate());40 }}41 >Rotate</button>42 {/* down */}43 <button44 disabled={!isRunning || gameOver}45 className="control-button"46 onClick={(e) => {47 if (!isRunning || gameOver) {48 return;49 }50 dispatch(moveDown());51 }}52 >Down</button>53 </div>54 );...

Full Screen

Full Screen

app.js

Source:app.js Github

copy

Full Screen

...3const app2 = sexpress({ name: 'new', run: true })4const app3 = sexpress()5const app4 = sexpress({ name: 'never' })6console.log('NONE:', {7 app1: app.isRunning(),8 ap2: app2.isRunning(),9 app3: app3.isRunning(),10 app4: app4.isRunning(),11})12app.run().then(async () => {13 console.log('TWO:', {14 app1: app.isRunning(),15 app2: app2.isRunning(),16 app3: app3.isRunning(),17 app4: app4.isRunning(),18 })19 await app3.run().then(() => {20 console.log('FOUR:', {21 app1: app.isRunning(),22 app2: app2.isRunning(),23 app3: app3.isRunning(),24 app4: app4.isRunning(),25 })26 })27 console.log('THREE:', {28 app1: app.isRunning(),29 app2: app2.isRunning(),30 app3: app3.isRunning(),31 app4: app4.isRunning(),32 })33})34console.log('ONE:', {35 app1: app.isRunning(),36 app2: app2.isRunning(),37 app3: app3.isRunning(),38 app4: app4.isRunning(),...

Full Screen

Full Screen

background.js

Source:background.js Github

copy

Full Screen

1chrome.alarms.create("hourglassTimer", {2 periodInMinutes: 1 / 60,3});4chrome.alarms.onAlarm.addListener((alarm) => {5 if (alarm.name === "hourglassTimer") {6 chrome.storage.local.get(["timer", "isRunning", "timeOption"], (res) => {7 if (res.isRunning) {8 let timer = res.timer + 1;9 let isRunning = true;10 if (timer === 60 * res.timeOption) {11 this.registration.showNotification("Hourglass", {12 body: `${res.timeOption} minutes is passed!`,13 icon: "image/hourglass.png",14 });15 timer = 0;16 isRunning = false;17 }18 chrome.storage.local.set({19 timer,20 isRunning,21 });22 }23 });24 }25});26chrome.storage.local.get(["timer", "isRunning", "timeOption"], (res) => {27 chrome.storage.local.set({28 timer: "timer" in res ? res.timer : 0,29 timeOption: "timerOption" in res ? res.timeOption : 25,30 isRunning: "isRunning" in res ? res.isRunning : false,31 });...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var root = require('root');2console.log(root.isRunning());3var child = require('./child');4console.log(child.isRunning());5var root = require('root');6module.exports.isRunning = function(){7 return root.isRunning();8};9var root = require('root');10console.log(root.isRoot());11var child = require('./child');12console.log(child.isRoot());13var root = require('root');14module.exports.isRoot = function(){15 return root.isRoot();16};17var root = require('root');18console.log(root.isRoot());19var child = require('./child');20console.log(child.isRoot());21var root = require('root');22module.exports.isRoot = function(){23 return root.isRoot();24};25var root = require('root');26console.log(root.isRoot());27var root = require('root');28console.log(root.isRoot

Full Screen

Using AI Code Generation

copy

Full Screen

1var root = require('root');2var isRunning = root.isRunning;3var child = require('child');4var isRunning = child.isRunning;5var child = require('child');6var isRunning = child.isRunning;7var child = require('child');8var isRunning = child.isRunning;9var root = require('root');10var isRunning = root.isRunning;11var root = require('root');12var isRunning = root.isRunning;13var root = require('root');14var isRunning = root.isRunning;15var child = require('child');16var isRunning = child.isRunning;

Full Screen

Using AI Code Generation

copy

Full Screen

1var root = require('Root');2var isRunning = root.isRunning;3var root = require('Root');4var isRunning = root.isRunning;5var root = require('Root');6var isRunning = root.isRunning;7var isRunning = require('isRunning');8var isRunning = require('isRunning');9var root = require('Root');10var isRunning = root.isRunning;11var isRunning = require('./isRunning').isRunning;

Full Screen

Using AI Code Generation

copy

Full Screen

1const { isRunning } = require("node:process");2const { isRunning } = require("node:child_process");3const { isRunning } = require("node:cluster");4const { isRunning } = require("node:worker_threads");5const { isRunning } = require("node:dgram");6const { isRunning } = require("node:dns");7const { isRunning } = require("node:domain");8const { isRunning } = require("node:events");9const { isRunning } = require("node:fs");10const { isRunning } = require("node:http");11const { isRunning } = require("node:https");12const { isRunning } = require("node:net");13const { isRunning } = require("node:os");14const { isRunning } = require("node:path");15const { isRunning } = require("node:perf_hooks");16const { isRunning } = require("node:punycode");17const { isRunning } = require("node:querystring");18const { isRunning } = require("node:readline");19const { isRunning } = require("node:repl");20const { isRunning } = require("node:stream");21const { isRunning } = require("node:string_decoder");22const {

Full Screen

Using AI Code Generation

copy

Full Screen

1var root = this;2root.print(result);3var root = this;4root.print(result);5var root = this;6root.print(result);7var root = this;8root.print(result);9var root = this;10root.print(result);11var root = this;12root.print(result);13var root = this;14root.print(result);15var root = this;16root.print(result);17var root = this;18root.print(result);19var root = this;20root.print(result);21var root = this;22root.print(result);23var root = this;24root.print(result);25var root = this;26root.print(result);

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run root automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful