How to use addMonitor method in wpt

Best JavaScript code snippet using wpt

util.js

Source:util.js Github

copy

Full Screen

...67 document.body.appendChild(img);68}69export function AddPointer (pointer, pane) {70 const folder = pane.addFolder({ title: `Pointer ${pointer.id}`, expanded: false });71 folder.addMonitor(pointer, 'active');72 folder.addMonitor(pointer, 'angle');73 folder.addMonitor(pointer, 'buttons');74 folder.addMonitor(pointer, 'deltaX');75 folder.addMonitor(pointer, 'deltaY');76 folder.addMonitor(pointer, 'deltaZ');77 folder.addMonitor(pointer, 'distance');78 folder.addMonitor(pointer, 'downX');79 folder.addMonitor(pointer, 'downY');80 folder.addMonitor(pointer, 'id');81 folder.addMonitor(pointer, 'isDown');82 folder.addMonitor(pointer, 'locked');83 folder.addMonitor(pointer, 'movementX');84 folder.addMonitor(pointer, 'movementY');85 folder.addMonitor(pointer, 'primaryDown');86 folder.addMonitor(pointer, 'upX');87 folder.addMonitor(pointer, 'upY');88 folder.addMonitor(pointer.velocity, 'x', { label: 'velocity x' });89 folder.addMonitor(pointer.velocity, 'y', { label: 'velocity y' });90 folder.addMonitor(pointer, 'worldX');91 folder.addMonitor(pointer, 'worldY');92 folder.addMonitor(pointer, 'x');93 folder.addMonitor(pointer, 'y');94 return folder;95}96export function AddSound (sound, pane) {97 const folder = pane.addFolder({ title: `Sound “${sound.key}”`, expanded: false });98 sound.once('destroy', () => { folder.dispose(); });99 if (sound.currentMarker) {100 folder.addMonitor(sound.currentMarker, 'name');101 }102 folder.addMonitor(sound, 'duration');103 folder.addMonitor(sound, 'isPaused');104 folder.addMonitor(sound, 'isPlaying');105 folder.addMonitor(sound, 'seek');106 folder.addMonitor(sound, 'totalDuration');107 folder.addMonitor(sound, 'loop');108 folder.addInput(sound, 'mute');109 folder.addInput(sound, 'volume', { min: 0, max: 1 });110 folder.addButton({ title: 'Play' }).on('click', () => { console.info('Play sound “%s”', sound.key); sound.play(); });111 folder.addButton({ title: 'Pause' }).on('click', () => { console.info('Pause sound “%s”', sound.key); sound.pause(); });112 folder.addButton({ title: 'Resume' }).on('click', () => { console.info('Resume sound “%s”', sound.key); sound.resume(); });113 folder.addButton({ title: 'Stop' }).on('click', () => { console.info('Stop sound “%s”', sound.key); sound.stop(); });114 folder.addButton({ title: 'Remove' }).on('click', () => { console.info('Remove sound “%s”', sound.key); sound.destroy(); });115 for (const name in sound.markers) {116 folder.addButton({ title: `Play “${name}”` }).on('click', () => { console.info('Play sound “%s” marker “%s”', sound.key, name); sound.play(name); });117 }118 return folder;119}120export function displayListItemToPrint ({ name, type, x, y, visible, depth }) {121 return { name, type, x, y, visible, depth };122}123export function updateListItemToPrint ({ name, type, active }) {124 return { name, type, active };125}126export function tweenToPrint ({ duration, elapsed, paused, progress, state, totalElapsed, totalProgress }) {127 return { duration, elapsed, paused, progress, state, totalElapsed, totalProgress };128}129export function timerEventToPrint ({ delay, elapsed, loop, paused, repeat, repeatCount }) {130 return { delay, elapsed, loop, paused, repeat, repeatCount };131}132export function keyToPrint ({ duration, emitOnRepeat, enabled, isDown, isUp, location, repeats, timeDown, timeUp }) {133 return { duration, emitOnRepeat, enabled, isDown, isUp, location, repeats, timeDown, timeUp };134}135export function cameraToPrint ({ name, id, x, y, width, height, visible, alpha }) {136 return { name, id, x, y, width, height, visible, alpha };137}138export function lightToPrint ({ x, y, radius, color, intensity, visible }) {139 return { x, y, radius, color: `rgb(${color.r.toFixed(2)}, ${color.g.toFixed(2)}, ${color.b.toFixed(2)})`, intensity, visible };140}141export function AddCamera (camera, pane) {142 const defaultCamera = camera.cameraManager.default;143 const w = defaultCamera.width;144 const h = defaultCamera.height;145 const folder = pane.addFolder({ title: `Camera ${camera.id} ${camera.name || ''}`, expanded: false });146 folder.addMonitor(camera, 'name');147 folder.addInput(camera, 'alpha', { min: 0, max: 1, step: 0.05 });148 folder.addInput(camera, 'backgroundColor');149 folder.addInput(camera, 'x', { min: -w, max: w, step: 10 });150 folder.addInput(camera, 'y', { min: -h, max: h, step: 10 });151 folder.addInput(camera, 'width', { min: 0, max: w, step: 10 });152 folder.addInput(camera, 'height', { min: 0, max: h, step: 10 });153 folder.addInput(camera, 'scrollX', { min: -w, max: w, step: 10 });154 folder.addInput(camera, 'scrollY', { min: -h, max: h, step: 10 });155 folder.addInput(camera, 'originX', { min: 0, max: 1, step: 0.05 });156 folder.addInput(camera, 'originY', { min: 0, max: 1, step: 0.05 });157 folder.addInput(camera, 'rotation', { min: 0, max: TAU });158 folder.addInput(camera, 'zoom', { min: 0.1, max: 10, step: 0.05 });159 folder.addInput(camera, 'followOffset');160 folder.addInput(camera, 'disableCull');161 folder.addInput(camera, 'inputEnabled');162 folder.addInput(camera, 'roundPixels');163 folder.addInput(camera, 'useBounds');164 folder.addInput(camera, 'visible');165 folder.addMonitor(camera, 'centerX');166 folder.addMonitor(camera, 'centerY');167 folder.addMonitor(camera.midPoint, 'x', { label: 'midPoint x' });168 folder.addMonitor(camera.midPoint, 'y', { label: 'midPoint y' });169 folder.addMonitor(camera.worldView, 'x', { label: 'world x' });170 folder.addMonitor(camera.worldView, 'y', { label: 'world y' });171 folder.addMonitor(camera.worldView, 'width', { label: 'world width' });172 folder.addMonitor(camera.worldView, 'height', { label: 'world height' });173 // TODO174 const { deadzone } = camera;175 if (deadzone) {176 folder.addMonitor(deadzone, 'x', { label: 'deadzone x' });177 folder.addMonitor(deadzone, 'y', { label: 'deadzone y' });178 folder.addMonitor(deadzone, 'width', { label: 'deadzone width' });179 folder.addMonitor(deadzone, 'height', { label: 'deadzone height' });180 }181 folder.addButton({ title: 'Fade in' }).on('click', () => { camera.fadeIn(); });182 folder.addButton({ title: 'Fade out' }).on('click', () => { camera.fadeOut(); });183 folder.addButton({ title: 'Flash' }).on('click', () => { camera.flash(); });184 folder.addButton({ title: 'Reset effects' }).on('click', () => { camera.resetFX(); });185 folder.addButton({ title: 'Shake' }).on('click', () => { camera.shake(); });186 camera.on(CameraEvents.DESTROY, () => {187 folder.dispose();188 });189 return folder;190}191export function AddArcadePhysicsWorld (world, pane) {192 const { arcadePhysics, events } = world.scene.sys;193 const folder = pane.addFolder({ title: 'Arcade Physics', expanded: false });194 folder.addMonitor(world.bodies, 'size', { label: 'bodies' });195 folder.addInput(world, 'fixedStep');196 folder.addInput(world, 'forceX');197 folder.addInput(world, 'fps', { min: 5, max: 300, step: 5 }).on('change', ({ value }) => { world.setFPS(value); });198 folder.addMonitor(world, '_frameTimeMS');199 folder.addInput(world, 'gravity', { x: { min: -1000, max: 1000 }, y: { min: -1000, max: 1000 } });200 folder.addInput(world, 'isPaused');201 folder.addInput(world, 'OVERLAP_BIAS', { label: 'overlap bias', min: 0, max: 32, step: 1 });202 folder.addMonitor(world.staticBodies, 'size', { label: 'staticBodies' });203 folder.addInput(world, 'TILE_BIAS', { label: 'tile bias', min: 0, max: 32, step: 1 });204 folder.addInput(world, 'timeScale', { min: 0.1, max: 10, step: 0.1 });205 folder.addInput(world, 'useTree');206 if (world.debugGraphic) {207 folder.addInput(world.debugGraphic, 'visible', { label: 'debug' });208 }209 folder.addButton({ title: 'Enable update' }).on('click', () => { arcadePhysics.enableUpdate(); });210 folder.addButton({ title: 'Disable update' }).on('click', () => { arcadePhysics.disableUpdate(); });211 folder.addButton({ title: 'Update' }).on('click', () => { world.update(0, world._frameTimeMS || (1000 / 60)); });212 folder.addButton({ title: 'Print colliders' }).on('click', () => { console.info('Colliders', world.colliders.getActive()); });213 events.once(SceneEvents.SHUTDOWN, () => {214 folder.dispose();215 });216 return folder;217}218export function AddMatterPhysicsWorld (world, pane) {219 const { events } = world.scene.sys;220 const folder = pane.addFolder({ title: 'Matter Physics', expanded: false });221 folder.addInput(world, 'autoUpdate');222 folder.addInput(world, 'correction', { min: 0.1, max: 1, step: 0.05 });223 folder.addInput(world, 'enabled');224 folder.addInput(world.localWorld, 'gravity');225 folder.addInput(world.localWorld.gravity, 'scale', { label: 'gravity scale', min: 0, max: 0.1, step: 0.001 });226 if (world.debugGraphic) {227 folder.addInput(world.debugGraphic, 'visible', { label: 'debug' });228 }229 folder.addButton({ title: 'Pause' }).on('click', () => { world.pause(); });230 folder.addButton({ title: 'Resume' }).on('click', () => { world.resume(); });231 folder.addButton({ title: 'Step' }).on('click', () => { world.step(); });232 events.once(SceneEvents.SHUTDOWN, () => {233 folder.dispose();234 });235 return folder;236}237export function AddGameObject (obj, pane, options = { title: `${obj.type} “${obj.name}”` }) {238 const folder = pane.addFolder(options);239 folder.addInput(obj, 'active');240 folder.addMonitor(obj, 'cameraFilter');241 folder.addMonitor(obj, 'state');242 if ('texture' in obj && obj.texture && obj.texture.key) {243 const proxy = {244 get 'texture.key' () { return obj.texture.key; },245 get 'frame.name' () { return obj.frame.name; }246 };247 folder.addMonitor(proxy, 'texture.key');248 folder.addMonitor(proxy, 'frame.name');249 }250 if ('displayTexture' in obj) {251 const proxy = {252 get 'displayTexture.key' () { return obj.displayTexture.key; },253 get 'displayFrame.name' () { return obj.displayFrame.name; }254 };255 folder.addMonitor(proxy, 'displayTexture.key');256 folder.addMonitor(proxy, 'displayFrame.name');257 }258 if ('alpha' in obj) {259 folder.addInput(obj, 'alpha', { min: 0, max: 1, step: 0.05 });260 }261 if ('blendMode' in obj) {262 folder.addInput(obj, 'blendMode', { options: BlendModes });263 }264 if ('depth' in obj) {265 folder.addMonitor(obj, 'depth');266 }267 if ('width' in obj) {268 folder.addMonitor(obj, 'width');269 folder.addMonitor(obj, 'height');270 }271 if ('displayWidth' in obj) {272 folder.addMonitor(obj, 'displayWidth');273 folder.addMonitor(obj, 'displayHeight');274 }275 if ('originX' in obj) {276 folder.addMonitor(obj, 'originX');277 folder.addMonitor(obj, 'originY');278 }279 if ('displayOriginX' in obj) {280 folder.addMonitor(obj, 'displayOriginX');281 folder.addMonitor(obj, 'displayOriginY');282 }283 if ('scaleX' in obj) {284 folder.addMonitor(obj, 'scaleX');285 folder.addMonitor(obj, 'scaleY');286 folder.addInput(obj, 'scale', { min: 0.1, max: 10, step: 0.1 });287 }288 if ('flipX' in obj) {289 folder.addInput(obj, 'flipX');290 folder.addInput(obj, 'flipY');291 }292 if ('angle' in obj) {293 folder.addMonitor(obj, 'angle');294 }295 if ('rotation' in obj) {296 folder.addInput(obj, 'rotation', { min: 0, max: TAU, step: 0.01 * TAU });297 }298 if ('visible' in obj) {299 folder.addInput(obj, 'visible');300 }301 if ('x' in obj) {302 folder.addMonitor(obj, 'x');303 folder.addMonitor(obj, 'y');304 folder.addMonitor(obj, 'z');305 folder.addMonitor(obj, 'w');306 }307 if ('pipeline' in obj) {308 folder.addMonitor(obj.pipeline, 'name', { label: 'pipeline.name' });309 folder.addMonitor(obj, 'hasPostPipeline');310 }311 if ('children' in obj && 'length' in obj.children) {312 folder.addMonitor(obj.children, 'length', { label: 'children (length)', format: FormatLength });313 }314 if ('emitters' in obj) {315 folder.addMonitor(obj.emitters, 'length', { label: 'emitters (length)', format: FormatLength });316 }317 folder.addButton({ title: 'Destroy' }).on('click', () => { obj.destroy(); });318 obj.once(GameObjectEvents.DESTROY, () => { folder.dispose(); });319 return folder;320}321export function AddGroup (group, pane, options = { title: `${group.type} “${group.name}”` }) {322 const folder = pane.addFolder(options);323 const graphOptions = { view: 'graph', min: 0, max: group.maxSize === -1 ? 100 : group.maxSize };324 folder.addMonitor(group.getChildren(), 'length', graphOptions);325 const proxy = {326 get active () { return group.countActive(true); },327 get inactive () { return group.countActive(false); },328 get free () { return group.getTotalFree(); },329 get full () { return group.isFull(); }330 };331 folder.addMonitor(proxy, 'active', graphOptions);332 folder.addMonitor(proxy, 'inactive', graphOptions);333 if (group.maxSize > -1) { folder.addMonitor(proxy, 'free', graphOptions); }334 folder.addMonitor(group, 'maxSize');335 folder.addMonitor(proxy, 'full');336 folder.addButton({ title: 'Clear' }).on('click', () => { console.info('Clear group'); group.clear(); });337 folder.addButton({ title: 'Destroy' }).on('click', () => { console.info('Destroy group'); group.destroy(); });338 folder.addButton({ title: 'Destroy group members' }).on('click', () => { console.info('Destroy group members'); group.clear(true, true); });339 group.once(GameObjectEvents.DESTROY, () => { folder.dispose(); });340 return folder;341}342export function AddLight (light, pane, options = { title: 'Light' }) {343 const folder = pane.addFolder(options);344 folder.addInput(light, 'color', { color: { type: 'float' } });345 folder.addInput(light, 'intensity', { min: 0, max: 10, step: 0.1 });346 folder.addInput(light, 'radius', { min: 0, max: 1024, step: 8 });347 folder.addInput(light, 'visible');348 folder.addMonitor(light, 'x');349 folder.addMonitor(light, 'y');350 return folder;351}352export function AddParticleEmitter (emitter, pane, options = { title: `Particle Emitter “${emitter.name}”` }) {353 const folder = pane.addFolder(options);354 const max = emitter.maxParticles || 100;355 folder.addMonitor(emitter, 'active');356 folder.addMonitor(emitter, 'on');357 folder.addInput(emitter, 'visible');358 folder.addInput(emitter, 'blendMode', { options: BlendModes });359 folder.addInput(emitter, 'frequency', { min: -1, max: 1000 });360 folder.addMonitor(emitter.alive, 'length', { view: 'graph', min: 0, max: max, label: 'alive (length)', format: FormatLength });361 folder.addMonitor(emitter.dead, 'length', { view: 'graph', min: 0, max: max, label: 'dead (length)', format: FormatLength });362 folder.addInput(emitter, 'collideBottom');363 folder.addInput(emitter, 'collideLeft');364 folder.addInput(emitter, 'collideRight');365 folder.addInput(emitter, 'collideTop');366 folder.addMonitor(emitter, 'currentFrame');367 folder.addMonitor(emitter, 'maxParticles');368 folder.addInput(emitter, 'moveTo');369 folder.addInput(emitter, 'particleBringToTop');370 folder.addInput(emitter, 'radial');371 folder.addInput(emitter, 'randomFrame');372 folder.addInput(emitter, 'timeScale', { min: 0.1, max: 10, step: 0.1 });373 folder.addButton({ title: 'Start' }).on('click', () => { emitter.start(); });374 folder.addButton({ title: 'Stop' }).on('click', () => { emitter.stop(); });375 folder.addButton({ title: 'Pause' }).on('click', () => { emitter.pause(); });376 folder.addButton({ title: 'Resume' }).on('click', () => { emitter.resume(); });377 folder.addButton({ title: 'Print JSON' }).on('click', () => { console.log(JSON.stringify(emitter.toJSON())); });378 emitter.manager.once(GameObjectEvents.DESTROY, () => { folder.dispose(); });379 return folder;380}381export function AddTween (tween, pane, options = { title: 'Tween' }) {382 const folder = pane.addFolder(options);383 folder.addMonitor(tween, 'countdown');384 folder.addMonitor(tween, 'duration');385 folder.addMonitor(tween, 'elapsed');386 folder.addMonitor(tween, 'loop');387 folder.addMonitor(tween, 'loopCounter');388 folder.addMonitor(tween, 'state');389 folder.addInput(tween, 'timeScale', { min: 0.1, max: 10, step: 0.1 });390 folder.addMonitor(tween, 'totalData');391 folder.addMonitor(tween, 'totalDuration');392 folder.addMonitor(tween, 'totalElapsed');393 folder.addMonitor(tween, 'totalProgress', { view: 'graph', min: 0, max: 1 });394 for (const dat of tween.data) {395 folder.addMonitor(dat, 'progress', { view: 'graph', min: 0, max: 1, label: `${dat.key} progress` });396 }397 for (const dat of tween.data) {398 folder.addMonitor(dat, 'current', { label: `${dat.key} current` });399 }400 folder.addButton({ title: 'Play' }).on('click', () => { console.info('Play tween'); tween.play(); });401 folder.addButton({ title: 'Pause' }).on('click', () => { console.info('Pause tween'); tween.pause(); });402 folder.addButton({ title: 'Resume' }).on('click', () => { console.info('Resume tween'); tween.resume(); });403 folder.addButton({ title: 'Stop' }).on('click', () => { console.info('Stop tween'); tween.stop(); });404 folder.addButton({ title: 'Restart' }).on('click', () => { console.info('Restart tween'); tween.restart(); });405 folder.addButton({ title: 'Remove' }).on('click', () => { console.info('Remove tween'); tween.remove(); });406 return folder;407}408export function AddTimeline (timeline, pane, options = { title: 'Timeline' }) {409 const folder = pane.addFolder(options);410 folder.addMonitor(timeline, 'duration');411 folder.addMonitor(timeline, 'elapsed');412 folder.addMonitor(timeline, 'loop');413 folder.addMonitor(timeline, 'loopCounter');414 folder.addMonitor(timeline, 'state');415 folder.addInput(timeline, 'timeScale', { min: 0.1, max: 10, step: 0.1 });416 folder.addMonitor(timeline, 'totalData');417 folder.addMonitor(timeline, 'totalDuration');418 folder.addMonitor(timeline, 'totalElapsed');419 folder.addMonitor(timeline, 'totalProgress', { view: 'graph', min: 0, max: 1 });420 folder.addButton({ title: 'Play' }).on('click', () => { console.info('Play timeline'); timeline.play(); });421 folder.addButton({ title: 'Pause' }).on('click', () => { console.info('Pause timeline'); timeline.pause(); });422 folder.addButton({ title: 'Resume' }).on('click', () => { console.info('Resume timeline'); timeline.resume(); });423 folder.addButton({ title: 'Stop' }).on('click', () => { console.info('Stop timeline'); timeline.stop(); });424 folder.addButton({ title: 'Destroy' }).on('click', () => { console.info('Destroy timeline'); timeline.destroy(); folder.dispose(); });425 return folder;426}427export function AddTimerEvent (timer, pane, options = { title: 'Timer Event' }) {428 const folder = pane.addFolder(options);429 folder.addMonitor(timer, 'elapsed', { view: 'graph', min: 0, max: timer.delay });430 folder.addMonitor(timer, 'elapsed');431 folder.addMonitor(timer, 'hasDispatched');432 folder.addMonitor(timer, 'loop');433 folder.addInput(timer, 'paused');434 folder.addMonitor(timer, 'repeat');435 folder.addMonitor(timer, 'repeatCount');436 folder.addButton({ title: 'Remove' }).on('click', () => { timer.remove(); });437 folder.addButton({ title: 'Reset' }).on('click', () => { timer.reset(); });438 return folder;439}440export function AddInput (input, pane, options = { title: `Input (${input.gameObject.type} “${input.gameObject.name}”)` }) {441 const folder = pane.addFolder(options);442 folder.addMonitor(input, 'alwaysEnabled');443 folder.addMonitor(input, 'cursor');444 folder.addMonitor(input, 'customHitArea');445 folder.addMonitor(input, 'draggable');446 folder.addMonitor(input, 'dragStartX');447 folder.addMonitor(input, 'dragStartXGlobal');448 folder.addMonitor(input, 'dragStartY');449 folder.addMonitor(input, 'dragStartYGlobal');450 folder.addMonitor(input, 'dragState');451 folder.addMonitor(input, 'dragX');452 folder.addMonitor(input, 'dragY');453 folder.addMonitor(input, 'dropZone');454 folder.addMonitor(input, 'enabled');455 folder.addMonitor(input, 'localX');456 folder.addMonitor(input, 'localY');457 input.gameObject.once(GameObjectEvents.DESTROY, () => { folder.dispose(); });458 return folder;459}460export function AddArcadeBody (body, pane, options = { title: `Body (${body.gameObject.type} “${body.gameObject.name}”)` }) {461 const folder = pane.addFolder(options);462 folder.addMonitor(body, 'enable');463 folder.addInput(body, 'debugShowBody');464 folder.addInput(body, 'debugShowVelocity');465 folder.addInput(body, 'debugBodyColor', { view: 'color' });466 folder.addMonitor(body.velocity, 'x', { label: 'velocity x' });467 folder.addMonitor(body.velocity, 'y', { label: 'velocity y' });468 folder.addMonitor(body, 'speed');469 folder.addMonitor(body, 'angle');470 folder.addMonitor(body, '_dx', { label: 'deltaX' });471 folder.addMonitor(body, '_dy', { label: 'deltaY' });472 folder.addMonitor(body, '_tx', { label: 'deltaXFinal' });473 folder.addMonitor(body, '_ty', { label: 'deltaYFinal' });474 body.gameObject.once(GameObjectEvents.DESTROY, () => { folder.dispose(); });475 return folder;476}477export function AddAnimationState (state, pane, options = { title: `Animation (${state.parent.type} “${state.parent.name}”)` }) {478 const folder = pane.addFolder(options);479 const proxy = {480 get 'getName()' () { return state.getName(); },481 get 'getFrameName()' () { return state.getFrameName(); },482 get nextAnim () { return state.nextAnim ? (state.nextAnim.key || state.nextAnim) : ''; }483 };484 folder.addMonitor(proxy, 'getName()');485 folder.addMonitor(proxy, 'getFrameName()');486 folder.addMonitor(state, 'delay');487 folder.addMonitor(state, 'delayCounter');488 folder.addMonitor(state, 'duration');489 folder.addMonitor(state, 'forward');490 folder.addMonitor(state, 'frameRate');491 folder.addMonitor(state, 'hasStarted');492 folder.addMonitor(state, 'isPaused');493 folder.addMonitor(state, 'isPlaying');494 folder.addMonitor(state, 'msPerFrame');495 folder.addMonitor(proxy, 'nextAnim', { label: 'nextAnim (key)' });496 folder.addMonitor(state.nextAnimsQueue, 'length', { label: 'nextAnimsQueue (length)', format: FormatLength });497 folder.addMonitor(state, 'repeat');498 folder.addMonitor(state, 'repeatCounter');499 folder.addMonitor(state, 'repeatDelay');500 folder.addInput(state, 'skipMissedFrames');501 folder.addInput(state, 'timeScale', { min: 0.1, max: 10, step: 0.1 });502 folder.addMonitor(state, 'yoyo');503 folder.addButton({ title: 'Stop' }).on('click', () => { console.info('Stop animation'); state.stop(); });504 folder.addButton({ title: 'Pause' }).on('click', () => { console.info('Pause animation'); state.pause(); });505 folder.addButton({ title: 'Resume' }).on('click', () => { console.info('Resume animation'); state.resume(); });506 folder.addButton({ title: 'Restart' }).on('click', () => { console.info('Restart animation'); state.restart(); });507 folder.addButton({ title: 'Reverse' }).on('click', () => { console.info('Reverse animation'); state.reverse(); });508 folder.addButton({ title: 'Next frame' }).on('click', () => { console.info('Next animation frame'); state.nextFrame(); });509 folder.addButton({ title: 'Previous frame' }).on('click', () => { console.info('Previous animation frame'); state.previousFrame(); });510 state.parent.once(GameObjectEvents.DESTROY, () => { folder.dispose(); });511 return folder;512}513export function AddKey (key, pane, options = { title: `Key (${key.keyCode})` }) {514 const folder = pane.addFolder(options);515 folder.addMonitor(key, 'duration');516 folder.addInput(key, 'emitOnRepeat');517 folder.addInput(key, 'enabled');518 folder.addMonitor(key, 'isDown');519 folder.addMonitor(key, 'isUp');520 folder.addMonitor(key, 'location');521 folder.addMonitor(key, 'repeats');522 folder.addMonitor(key, 'timeDown');523 folder.addMonitor(key, 'timeUp');524 folder.addButton({ title: 'Destroy' }).on('click', () => { console.info('Destroy key'); key.destroy(); folder.dispose(); });525 return folder;526}527export function AddKeys (keys, pane, options = { title: 'Keys' }) {528 const folder = pane.addFolder(options);529 for (const name in keys) {530 const key = keys[name];531 folder.addMonitor(key, 'isDown', { label: `${name} isDown` });532 }533 return folder;534}535export function FormatLength (len) {536 return len.toFixed(0);537}538export function InspectByName (name, gameObjects, pane) {539 if (name === null) return;540 const gameObject = GetFirst(gameObjects, 'name', name);541 if (!gameObject) {542 console.info('No game object found with name "%s"', name);543 return;544 }545 const newPane = AddGameObject(gameObject, pane);...

Full Screen

Full Screen

viewgis.js

Source:viewgis.js Github

copy

Full Screen

...164 });165 map.addLayer(monitorLayer);166 //167 var id= 1;168 function addMonitor(coordinate) {169 var sensor = document.getElementById(id);170 var sensorName = sensor.value;171 var alarmLevel = sensor.getAttribute('data');172 var feature = new ol.Feature({173 geometry: new ol.geom.Point(coordinate), //几何信息174 name: sensorName, //名称属性175 });176 if (alarmLevel == 0) {177 feature.setStyle(normalStyle);178 }else if (alarmLevel == 1) {179 feature.setStyle(warnningStyle1);180 }else if (alarmLevel == 2) {181 feature.setStyle(warnningStyle2);182 }else{183 feature.setStyle(warnningStyle3);184 }185 monitorSource.addFeature(feature);186 id++;187 }188 // 添加监测点189 //P-levelingTransducer190 addMonitor([2330, 1062]);191 addMonitor([2263, 1036]);192 addMonitor([2276, 999]);193 addMonitor([2186, 946]);194 addMonitor([2190, 894]);195 //InclinoMeter196 addMonitor([3103, 1630]);197 addMonitor([3130, 1632]);198 //LaserSensor199 addMonitor([1738, 604]);200 addMonitor([1716, 587]);201 addMonitor([1695, 572]);202 addMonitor([1673, 558]);203 addMonitor([1652, 542]);204 addMonitor([1630, 529]);205 addMonitor([1609, 515]);206 addMonitor([1588, 500]);207 addMonitor([1566, 486]);208 addMonitor([1557, 479]);209 //AnchorDynamometer210 addMonitor([1700, 527]);211 addMonitor([1689, 518]);212 addMonitor([1667, 503]);213 addMonitor([1646, 488]);214 addMonitor([1625, 473]);215 addMonitor([1603, 457]);216 addMonitor([1582, 444]);217 addMonitor([1560, 430]);218 addMonitor([1538, 417]);219 addMonitor([1527, 411]);220 //SteelStressMeter221 addMonitor([1347, 412]);222 addMonitor([1336, 412]);223 addMonitor([1313, 414]);224 addMonitor([1290, 416]);225 addMonitor([1268, 419]);226 addMonitor([1245, 419]);227 addMonitor([1222, 421]);228 addMonitor([1199, 425]);229 addMonitor([1176, 428]);230 addMonitor([1163, 429]);231 //StrainGauge232 addMonitor([1345, 365]);233 addMonitor([1329, 365]);234 addMonitor([1306, 368]);235 addMonitor([1283, 368]);236 addMonitor([1260, 370]);237 addMonitor([1238, 374]);238 addMonitor([1215, 375]);239 addMonitor([1192, 378]);240 addMonitor([1170, 379]);241 addMonitor([1158, 382]);242 243 // 244 function setInnerText(element, text) {245 if (typeof element.textContent == "string") {246 element.textContent = text;247 } else {248 element.innerText = text;249 }250 }251 // Popup-marker 252 var container = document.getElementById('popup');253 var content = document.getElementById('popup-content');254 var closer = document.getElementById('popup-closer');255 var checkbox_monitorLayer = document.getElementById("checkbox_monitorLayer");...

Full Screen

Full Screen

monitor-spec.js

Source:monitor-spec.js Github

copy

Full Screen

...71 ( addMonitor.calls ).should.be.an( "array" );72 });73 74 it( "stores arguments passed to each call", function() {75 addMonitor( 10, 20 );76 ( addMonitor.calls.length ).should.equal( 1 );77 ( addMonitor.calls[0].args[0] ).should.equal( 10 );78 ( addMonitor.calls[0].args[1] ).should.equal( 20 );79 });80 it( "stores stringified arguments passed to each call", function() {81 addMonitor( 10, 20 );82 ( addMonitor.calls.length ).should.equal( 1 );83 ( addMonitor.calls[0].argsStringified ).should.equal( "[10,20]" );84 });85 it( "stores return values from each call", function() {86 addMonitor( 10, 20 );87 ( addMonitor.calls[0].returnValue ).should.equal( 30 );88 });89 it( "stores 'this' values from each call", function() {90 addMonitor.call( ctx, 10, 20 );91 ( addMonitor.calls[0].context ).should.equal( ctx );92 });93 it( "stores the call number of each call", function() {94 addMonitor( 10, 20 );95 ( addMonitor.calls[0].nth ).should.equal( 0 );96 });97 it( "stores errors thrown by each call", function() {98 addMonitor( 10, 20, 30 );99 ( addMonitor.calls[0].error ).should.equal( err );100 });101 // Should look for a better way to do this.102 it( "stores the time at which each call occurred", function() {103 var time = Date.now();104 addMonitor( 10, 20 );105 // this occasionally fails if you check for straight equality.. w/in 1ms is close enough.106 ( isWithinOf( addMonitor.calls[0].timeStamp, time, 1 ) ).should.equal( true );107 });108 it( "stores the execution time of each call", function() {109 addMonitor( 10, 20 );110 ( addMonitor.calls[0].executionTime ).should.be.a( "number" );111 ( addMonitor.calls[0].executionTime ).should.be.lessThan( 1 );112 });113 });114 describe( ".callCount", function() {115 var addMonitor;116 var ctx = {};117 beforeEach(function() {118 addMonitor = monitor( add );119 });120 it( "stores the number of times the function has been called", function() {121 addMonitor( 10, 20 );122 ( addMonitor.callCount ).should.be.a( "number" );123 ( addMonitor.callCount ).should.equal( 1 );124 addMonitor( 20, 40 );125 ( addMonitor.callCount ).should.equal( 2 );126 });127 });128 describe( ".called", function() {129 var noopMonitor = monitor( noop );130 it( "is false if a monitor has never been called", function() {131 ( noopMonitor.called ).should.equal( false );132 });133 it( "is true if a monitor has been called at least once", function() {134 noopMonitor();135 ( noopMonitor.called ).should.equal( true );136 });137 });138 describe( ".lastReturn", function(){139 it( "stores the return value of the most recent call", function() {140 addMonitor( 10, 20 );141 ( addMonitor.lastReturn ).should.equal( 30 );142 addMonitor( 20, 40 );143 ( addMonitor.lastReturn ).should.equal( 60 );144 });145 });146 });147 describe( "methods", function() {148 149 var noopMonitor;150 beforeEach(function(){151 noopMonitor = monitor( noop );152 });153 describe( ".calledWith()", function() {154 it( "checks if the monitor has been called with a given argument", function() {155 noopMonitor( 10, 20 );156 ( noopMonitor.calledWith( 10 ) ).should.equal( true );...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest');2var wpt = new WebPageTest('www.webpagetest.org');3wpt.addMonitor(url, function(err, data) {4 if (err) {5 console.log(err);6 } else {7 console.log(data);8 }9});10{statusCode: 200, statusText: 'Ok', data: 'OK'}11var wpt = require('webpagetest');12var wpt = new WebPageTest('www.webpagetest.org');13wpt.addMonitor(url, function(err, data) {14 if (err) {15 console.log(err);16 } else {17 console.log(data);18 }19});20wpt.getLocations(function(err, data) {21 if (err) {22 console.log(err);23 } else {24 console.log(data);25 }26});27{statusCode: 200, statusText: 'Ok', data: {locations: {Dulles_IE7: {label: 'Dulles: IE7', group: 'Dulles', groupLabel: 'Dulles'}, Dulles_IE8: {label: 'Dulles: IE8', group: 'Dulles', groupLabel: 'Dulles'}, Dulles_IE9: {label: 'Dulles: IE9', group: 'Dulles', groupLabel: 'Dulles'}, Dulles_FF3: {label: 'Dulles: FF3', group: 'Dulles', groupLabel: 'Dulles'}, Dulles_FF4: {label: 'Dulles: FF4', group: 'Dulles', groupLabel: 'Dulles'}, Dulles_CHROME: {label: 'Dulles: CHROME', group: 'Dulles', groupLabel: 'Dulles'}, Dulles_SAFARI: {label: 'Dulles: SAFARI', group: 'Dulles', groupLabel: 'Dulles'}, Dulles_IPAD: {label

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest');2var wpt = new WebPageTest('www.webpagetest.org');3 if (err) {4 console.log(err);5 } else {6 console.log(data);7 }8});9{ statusCode: 200,10 data: { statusCode: 200, statusText: 'OK', data: 'OK' } }

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest');2var wpt = new WebPageTest('www.webpagetest.org');3wpt.addMonitor('www.google.com', function(err, data) {4 if (err) {5 console.log(err);6 } else {7 console.log(data);8 }9});10var wpt = require('webpagetest');11var wpt = new WebPageTest('www.webpagetest.org');12wpt.getLocations(function(err, data) {13 if (err) {14 console.log(err);15 } else {16 console.log(data);17 }18});19var wpt = require('webpagetest');20var wpt = new WebPageTest('www.webpagetest.org');21wpt.getTesters(function(err, data) {22 if (err) {23 console.log(err);24 } else {25 console.log(data);26 }27});28var wpt = require('webpagetest');29var wpt = new WebPageTest('www.webpagetest.org');30wpt.getTesters(function(err, data) {31 if (err) {32 console.log(err);33 } else {34 console.log(data);35 }36});37var wpt = require('webpagetest');38var wpt = new WebPageTest('www.webpagetest.org');39wpt.getTesters(function(err, data) {40 if (err) {41 console.log(err);42 } else {43 console.log(data);44 }45});46var wpt = require('webpagetest');47var wpt = new WebPageTest('www.webpagetest.org');48wpt.getTesters(function(err, data) {49 if (err) {50 console.log(err);51 } else {52 console.log(data);53 }54});55var wpt = require('webpagetest');56var wpt = new WebPageTest('www.webpagetest.org');

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest');2var wptObj = new wpt('API_KEY');3var options = {4};5wptObj.addMonitor(options, function(err, data) {6 if (err) {7 console.log('Error: ' + err);8 } else {9 console.log('Monitor Id: ' + data.data.id);10 }11});12wptObj.addMonitor(options, callback);13var wpt = require('webpagetest');14var wptObj = new wpt('API_KEY');15var options = {16};17wptObj.addMonitor(options, function(err, data) {18 if (err) {19 console.log('Error: ' + err);20 } else {21 console.log('Monitor Id: ' + data.data.id);22 }23});24var wpt = require('webpagetest');25var wptObj = new wpt('API_KEY');26var options = {

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptoolkit = require('wptoolkit');2 console.log(data);3});4var wptoolkit = require('wptoolkit');5 console.log(data);6});7var wptoolkit = require('wptoolkit');8 console.log(data);9});10var wptoolkit = require('wptoolkit');11 console.log(data);12});13var wptoolkit = require('wptoolkit');14 console.log(data);15});16var wptoolkit = require('wptoolkit');17 console.log(data);18});19var wptoolkit = require('wptoolkit');20 console.log(data);21});22var wptoolkit = require('wptoolkit');23 console.log(data);24});25var wptoolkit = require('wptoolkit');

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('wpt');2var monitor = new wpt.Monitor();3 console.log(err, data);4});5var wpt = require('wpt');6var monitor = new wpt.Monitor();7 console.log(err, data);8});9var wpt = require('wpt');10var monitor = new wpt.Monitor();11 console.log(err, data);12});13var wpt = require('wpt');14var monitor = new wpt.Monitor();15 console.log(err, data);16});17var wpt = require('wpt');18var monitor = new wpt.Monitor();19 console.log(err, data);20});21var wpt = require('wpt');22var monitor = new wpt.Monitor();23 console.log(err, data);24});25var wpt = require('wpt');26var monitor = new wpt.Monitor();27 console.log(err, data);28});29var wpt = require('wpt');30var monitor = new wpt.Monitor();31 console.log(err

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 wpt 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