How to use pageA method in wpt

Best JavaScript code snippet using wpt

hall.js

Source:hall.js Github

copy

Full Screen

1var HallPage = function () {2 var _self = this;3 var pageA, pageB;4 var pages = [];5 var pagePos = [{ x: 0, y: 0 }, { x: 0, y: 0 }];6 var gyeBindFlag = false;7 var showFlag = false;8 var controlFlag = false;9 var clickFlag = false;10 var centerX = 2545;11 var bgWidth = 6494;12 var nowIndex = 0;13 var moveViewFlag = false;14 var MoveData;15 var startData;16 var GyeData;17 var ParallaxTimer;18 /**19 * 初始化20 */21 _self.init = function () {22 uiInit();23 eventInit();24 setTimeout(function () {25 _self.open();26 }, 4500);27 }28 /**29 * 打开30 */31 _self.open = function () {32 controlFlag = true;33 showFlag = true;34 document.getElementById("gyeBtn").style.display = "none";35 }36 /**37 * 关闭38 */39 _self.close = function () {40 controlFlag = false;41 }42 /**43 * 销毁44 */45 _self.distroy = function () {46 showFlag = false;47 controlFlag = false;48 pageA.removeSelf();49 pageB.removeSelf();50 }51 /**52 * 陀螺仪授权53 */54 _self.gyeAuto = function () {55 if (!gyeBindFlag) {56 Laya.Browser.window.addEventListener("deviceorientation", (e) => {57 if (controlFlag) dealGyeData(e);58 }, false);59 }60 }61 /**62 * 事件初始化63 */64 function eventInit() {65 pageA.on(Laya.Event.MOUSE_DOWN, this, recordMoveData);66 pageA.on(Laya.Event.MOUSE_MOVE, this, changeMoveData);67 pageA.on(Laya.Event.MOUSE_UP, this, clearMoveData);68 pageB.on(Laya.Event.MOUSE_DOWN, this, recordMoveData);69 pageB.on(Laya.Event.MOUSE_MOVE, this, changeMoveData);70 pageB.on(Laya.Event.MOUSE_UP, this, clearMoveData);71 pageA.nextBtn.on(Laya.Event.CLICK, this, showPerfectionPage);72 pageB.nextBtn.on(Laya.Event.CLICK, this, showPerfectionPage);73 pageA.shipBtn.on(Laya.Event.CLICK, this, showIntro, ["ship"]);74 pageA.bellBtn.on(Laya.Event.CLICK, this, showIntro, ["bell"]);75 pageA.conch1Btn.on(Laya.Event.CLICK, this, showIntro, ["conch2"]);76 pageA.conch2Btn.on(Laya.Event.CLICK, this, showIntro, ["conch1"]);77 pageA.conch3Btn.on(Laya.Event.CLICK, this, showIntro, ["conch4"]);78 pageA.conch4Btn.on(Laya.Event.CLICK, this, showIntro, ["conch5"]);79 pageA.conch5Btn.on(Laya.Event.CLICK, this, showIntro, ["conch3"]);80 pageB.shipBtn.on(Laya.Event.CLICK, this, showIntro, ["ship"]);81 pageB.bellBtn.on(Laya.Event.CLICK, this, showIntro, ["bell"]);82 pageB.conch1Btn.on(Laya.Event.CLICK, this, showIntro, ["conch2"]);83 pageB.conch2Btn.on(Laya.Event.CLICK, this, showIntro, ["conch1"]);84 pageB.conch3Btn.on(Laya.Event.CLICK, this, showIntro, ["conch4"]);85 pageB.conch4Btn.on(Laya.Event.CLICK, this, showIntro, ["conch5"]);86 pageB.conch5Btn.on(Laya.Event.CLICK, this, showIntro, ["conch3"]);87 }88 /**89 * 显示介绍页面90 */91 function showIntro(name) {92 if (clickFlag) iIntro.show("intro", dialogData[name]);93 }94 /**95 * 显示臻萃馆页面96 */97 function showPerfectionPage() {98 if (showFlag && clickFlag) {99 showFlag = false;100 controlFlag = false;101 pageA.zOrder = 99;102 pageB.zOrder = 99;103 iPerfectionPage.init();104 Laya.Tween.to(pageA, {105 x: pageA.x - 300106 }, 1000, Laya.Ease.linearIn, null);107 Laya.Tween.to(pageB, {108 x: pageA.x - 300109 }, 1000, Laya.Ease.linearIn, null);110 Laya.Tween.to(pageA, {111 alpha: 0112 }, 700, Laya.Ease.linearIn, null, 1000);113 Laya.Tween.to(pageB, {114 alpha: 0115 }, 700, Laya.Ease.linearIn, null, 1000);116 setTimeout(function () {117 _self.distroy();118 }, 1700);119 }120 }121 /**122 * 处理陀螺仪数据123 * @param e 124 */125 function dealGyeData(e) {126 if (GyeData) {127 var diffX = e.alpha - GyeData.alpha;128 var diffY = e.gamma - GyeData.gamma;129 diffX = diffX < -20 || diffX > 20 ? 0 : diffX;130 diffY = diffY < -20 || diffY > 20 ? 0 : diffY;131 if (Math.abs(diffX) > 0.1) {132 pagePos[0].x += diffX * GYE_SENSITIVITY_X;133 pagePos[1].x += diffX * GYE_SENSITIVITY_X;134 GyeData.alpha = e.alpha;135 }136 if (Math.abs(diffY) > 0.05) {137 pagePos[0].y -= diffY * GYE_SENSITIVITY_Y;138 pagePos[1].y -= diffY * GYE_SENSITIVITY_Y;139 GyeData.gamma = e.gamma;140 }141 if (Math.abs(diffX) > 0.1 || Math.abs(diffY) > 0.05) {142 updatePagePos();143 updateParallax(diffX * 5, diffY * 5);144 }145 }146 GyeData = e;147 hideTips();148 gyeBindFlag = true;149 document.getElementById("gyeBtn").style.display = "none";150 }151 /**152 * 记录手指记录的值153 */154 function recordMoveData(e) {155 if (controlFlag) {156 moveViewFlag = true;157 MoveData = {};158 MoveData.x = e.stageX;159 MoveData.y = e.stageY;160 startData = {};161 startData.x = e.stageX;162 hideTips();163 clickFlag = true;164 }165 }166 /**167 * 改变手指记录的值168 */169 function changeMoveData(e) {170 if (controlFlag && MoveData && moveViewFlag) {171 var diffX = (e.stageX - MoveData.x) * MOVE_SENSITIVITY;172 var diffY = (e.stageY - MoveData.y) * MOVE_SENSITIVITY;173 pagePos[0].x += diffX;174 pagePos[1].x += diffX;175 pagePos[0].y += diffY;176 pagePos[1].y += diffY;177 updatePagePos();178 updateParallax(diffX, diffY);179 MoveData.x = e.stageX;180 MoveData.y = e.stageY;181 if (Math.abs(startData.x - e.stageX) > 15) clickFlag = false;182 }183 }184 /**185 * 清除手指记录的值186 */187 function clearMoveData() {188 MoveData = null;189 startData = null;190 moveViewFlag = false;191 }192 /**193 * 更新页面的位置194 */195 function updatePagePos() {196 correctData();197 pages[0].x = pagePos[0].x;198 pages[1].x = pagePos[1].x;199 pages[0].y = pagePos[0].y;200 pages[1].y = pagePos[1].y;201 }202 /**203 * 更新视差204 */205 function updateParallax(x, y) {206 ClearResumeParallax();207 // updateParallaxBg(x,y);208 updateParallaxPart(x, y, "part1", 10, PARALLAX_SENSITIVITY_PART1);209 updateParallaxPart(x, y, "part2", 20, PARALLAX_SENSITIVITY_PART2);210 updateParallaxPart(x, y, "part3", 40, PARALLAX_SENSITIVITY_PART3);211 clearTimeout(ParallaxTimer);212 ParallaxTimer = setTimeout(function () {213 resumeParallax();214 }, 200);215 }216 /**217 * 更新背景视差218 */219 function updateParallaxBg(x, y) {220 var diffS = Math.abs(x + y);221 var scale = pageA.bg.scaleY;222 scale -= diffS * SCALE_SENSITIVITY_BG;223 scale = scale < 0.98 ? 0.98 : scale;224 pageA.bg.scaleY = scale;225 pageB.bg.scaleY = scale;226 }227 /**228 * 更新视差229 * @param {*} x 230 * @param {*} y 231 */232 function updateParallaxPart(x, y, name, max, sens) {233 var lastx = pageA[name].x;234 var lasty = pageA[name].y;235 lastx -= x * sens;236 lastx = lastx > max ? max : lastx;237 lastx = lastx < -max ? -max : lastx;238 lasty -= y * sens;239 lasty = lasty > max ? max : lasty;240 lasty = lasty < -max ? -max : lasty;241 pageA[name].x = lastx;242 pageA[name].y = lasty;243 pageB[name].x = lastx;244 pageB[name].y = lasty;245 }246 /**247 * 清除恢复视差248 */249 function ClearResumeParallax() {250 // Laya.Tween.clearAll(pageA.bg);251 Laya.Tween.clearAll(pageA.part1);252 Laya.Tween.clearAll(pageA.part2);253 Laya.Tween.clearAll(pageA.part3);254 // Laya.Tween.clearAll(pageB.bg);255 Laya.Tween.clearAll(pageB.part1);256 Laya.Tween.clearAll(pageB.part2);257 Laya.Tween.clearAll(pageB.part3);258 }259 /**260 * 恢复视差261 */262 function resumeParallax() {263 // Laya.Tween.to(pageA.bg,{264 // scaleY:1265 // },1000)266 // Laya.Tween.to(pageB.bg,{267 // scaleY:1268 // },1000)269 Laya.Tween.to(pageA.part1, {270 x: 0,271 y: 0272 }, 1300)273 Laya.Tween.to(pageA.part2, {274 x: 0,275 y: 0276 }, 1200)277 Laya.Tween.to(pageA.part3, {278 x: 0,279 y: 0280 }, 700)281 Laya.Tween.to(pageB.part1, {282 x: 0,283 y: 0284 }, 1300)285 Laya.Tween.to(pageB.part2, {286 x: 0,287 y: 0288 }, 1200)289 Laya.Tween.to(pageB.part3, {290 x: 0,291 y: 0292 }, 700)293 }294 /**295 * 隐藏提示296 */297 function hideTips() {298 if (pageB.tips.visible) {299 Laya.Tween.to(pageA.tips, {300 alpha: 0301 }, 500);302 pageB.tips.visible = false;303 setTimeout(function () {304 pageA.tips.visible = false;305 }, 500)306 }307 }308 /**309 * 修正数据310 */311 function correctData() {312 var next = nowIndex == 1 ? 0 : 1;313 if (pagePos[nowIndex].x < -bgWidth + WindowW + 100 && pagePos[next].x < 0) pagePos[next].x += (bgWidth * 2);314 if (pagePos[nowIndex].x > -100 && pagePos[next].x > 0) pagePos[next].x -= (bgWidth * 2);315 if (pagePos[nowIndex].x < -bgWidth + WindowW / 2 || pagePos[nowIndex].x > WindowW / 2) {316 nowIndex = next;317 if (nowIndex == 1) {318 pageA.zOrder = 98;319 pageB.zOrder = 99;320 }321 else {322 pageA.zOrder = 99;323 pageB.zOrder = 98;324 }325 }326 pagePos[0].y = pagePos[0].y > 0 ? 0 : pagePos[0].y;327 pagePos[0].y = pagePos[0].y < -375 ? -375 : pagePos[0].y;328 pagePos[1].y = pagePos[1].y > 0 ? 0 : pagePos[1].y;329 pagePos[1].y = pagePos[1].y < -375 ? -375 : pagePos[1].y;330 }331 /**332 * ui初始化333 */334 function uiInit() {335 pageA = new hallUI();336 pageB = new hallUI();337 Laya.stage.addChild(pageB);338 Laya.stage.addChild(pageA);339 pages[0] = pageA.cont;340 pages[1] = pageB.cont;341 iClickTips.init(pageA.clickTips);342 iClickTips.init(pageB.clickTips);343 pagePos[0].x = -(centerX - 1624 / 2 - BgPageX);344 pagePos[1].x = -(bgWidth - pagePos[0].x);345 pagePos[0].y = -187;346 pagePos[1].y = -187;347 updatePagePos();348 }349}...

Full Screen

Full Screen

pageA.ts

Source:pageA.ts Github

copy

Full Screen

1// console.log('Hello PageA');2import _ from 'lodash';3console.log(_.join(['hello', 'PageA']));4import dayjs from 'dayjs';5console.log(dayjs(), 'PageA');6import './js/aa_1';7import './js/aa_2';8let counter = 0;9console.log('PageA.js---', counter++);10console.log('PageA.js', counter++);11console.log('PageA.js', counter++);12console.log('PageA.js', counter++);13console.log('PageA.js', counter++);14console.log('PageA.js', counter++);15console.log('PageA.js', counter++);16console.log('PageA.js', counter++);17console.log('PageA.js', counter++);18console.log('PageA.js', counter++);19console.log('PageA.js', counter++);20console.log('PageA.js', counter++);21console.log('PageA.js', counter++);22console.log('PageA.js', counter++);23console.log('PageA.js', counter++);24console.log('PageA.js', counter++);25console.log('PageA.js', counter++);26console.log('PageA.js', counter++);27console.log('PageA.js', counter++);28console.log('PageA.js', counter++);29console.log('PageA.js', counter++);30console.log('PageA.js', counter++);...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1wpt.pageA();2wpt.pageB();3wpt.pageC();4wpt.pageD();5wpt.pageE();6wpt.pageF();7wpt.pageG();8wpt.pageH();9wpt.pageI();10wpt.pageJ();11wpt.pageK();12wpt.pageL();13wpt.pageM();14wpt.pageN();15wpt.pageO();16wpt.pageP();17wpt.pageQ();18wpt.pageR();19wpt.pageS();20wpt.pageT();21wpt.pageU();22wpt.pageV();23wpt.pageW();24wpt.pageX();25wpt.pageY();26wpt.pageZ();27wpt.pageA();28wpt.pageB();29wpt.pageC();30wpt.pageD();31wpt.pageE();

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});9var wpt = require('webpagetest');10var wpt = new WebPageTest('www.webpagetest.org');11 if (err) {12 console.log(err);13 } else {14 console.log(data);15 }16});17var wpt = require('webpagetest');18var wpt = new WebPageTest('www.webpagetest.org');19 if (err) {20 console.log(err);21 } else {22 console.log(data);23 }24});25var wpt = require('webpagetest');26var wpt = new WebPageTest('www.webpagetest.org');27 if (err) {28 console.log(err);29 } else {30 console.log(data);31 }32});33var wpt = require('webpagetest');34var wpt = new WebPageTest('www.webpagetest.org');35 if (err) {36 console.log(err);37 } else {38 console.log(data);39 }40});41var wpt = require('webpagetest');42var wpt = new WebPageTest('www.webpagetest.org');43 if (err) {44 console.log(err);45 } else {46 console.log(data);47 }48});49var wpt = require('

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('wpt');2 if(err){3 console.log(err);4 }else{5 console.log(data);6 }7});8### wpt.pageB(url, options, callback)9var wpt = require('wpt');

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest');2var test = wpt('www.webpagetest.org');3}, function(err, data) {4 if (err) {5 console.log(err);6 } else {7 console.log(data);8 }9});10var wpt = require('webpagetest');11var test = wpt('www.webpagetest.org');12}, function(err, data) {13 if (err) {14 console.log(err);15 } else {16 console.log(data);17 }18});19var wpt = require('webpagetest');20var test = wpt('www.webpagetest.org');21}, function(err, data) {22 if (err) {23 console.log(err);24 } else {25 console.log(data);26 }27});28var wpt = require('webpagetest');29var test = wpt('www.webpagetest.org');30}, function(err, data) {31 if (err) {32 console.log(err);33 } else {34 console.log(data);35 }36});37var wpt = require('webpagetest');38var test = wpt('www.webpagetest.org');

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest');2 if(err) {3 console.log(err);4 } else {5 console.log(data);6 }7});

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('./wpt.js');2wpt.pageA();3wpt.pageB();4exports.pageA = function() {5 console.log('pageA');6};7exports.pageB = function() {8 console.log('pageB');9};

Full Screen

Using AI Code Generation

copy

Full Screen

1var page = require('webpage').create();2var wpt = require('./wpt.js');3wpt.pageA(page, url, function() {4 phantom.exit();5});6exports.pageA = function(page, url, callback) {7 page.open(url, function(status) {8 console.log("Status: " + status);9 if(status === "success") {10 page.render('pageA.png');11 }12 callback();13 });14};15var page = require('webpage').create();16var wpt = require('./wpt.js');17wpt.pageB(page, url, function() {18 phantom.exit();19});20exports.pageB = function(page, url, callback) {21 page.open(url, function(status) {22 console.log("Status: " + status);23 if(status === "success") {24 page.render('pageB.png');25 }26 callback();27 });28};

Full Screen

Using AI Code Generation

copy

Full Screen

1var pageA = require('./pageA.js');2pageA.methodA();3var pageB = require('./pageB.js');4pageB.methodB();5var pageA = require('./pageA.js');6pageA.methodA();7I have tried to use the following code in pageA.js and pageB.js but it is not working var pageA = require('./pageA.js'); pageA.methodA(); I am getting the following error: Uncaught TypeError: pageA.methodA is not a function8module.exports.methodA = function() {9}10var pageB = require('./pageB.js');11pageB.methodB();

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