How to use _reload method in Playwright Internal

Best JavaScript code snippet using playwright-internal

index.js

Source:index.js Github

copy

Full Screen

...56function _enableReloads() {57 _reloadingDisabled -= 1;58 59 if (_pendingReloads.length > 0) {60 _reload(_pendingReloads.shift());61 }62}6364function _reload(path) {65 if (_reloadingDisabled) {66 if ($.inArray(path, _pendingReloads) < 0) {67 _pendingReloads.push(path);68 }69 return;70 }71 72 _disableReloads();73 $.ajax({74 url: 'list',75 type: 'GET',76 data: {path: path},77 dataType: 'json'78 }).fail(function(jqXHR, textStatus, errorThrown) {79 _showError("Failed retrieving contents of \"" + path + "\"", textStatus, errorThrown);80 }).done(function(data, textStatus, jqXHR) {81 var scrollPosition = $(document).scrollTop();82 83 if (path != _path) {84 $("#path").empty();85 if (path == "/") {86 $("#path").append('<li class="active">' + _device + '</li>');87 } else {88 $("#path").append('<li data-path="/"><a>' + _device + '</a></li>');89 var components = path.split("/").slice(1, -1);90 for (var i = 0; i < components.length - 1; ++i) {91 var subpath = "/" + components.slice(0, i + 1).join("/") + "/";92 $("#path").append('<li data-path="' + subpath + '"><a>' + components[i] + '</a></li>');93 }94 $("#path > li").click(function(event) {95 _reload($(this).data("path"));96 event.preventDefault();97 });98 $("#path").append('<li class="active">' + components[components.length - 1] + '</li>');99 }100 _path = path;101 }102 103 $("#listing").empty();104 for (var i = 0, file; file = data[i]; ++i) {105 $(tmpl("template-listing", file)).data(file).appendTo("#listing");106 }107 108 $(".edit").editable(function(value, settings) { 109 var name = $(this).parent().parent().data("name");110 if (value != name) {111 var path = $(this).parent().parent().data("path");112 $.ajax({113 url: 'move',114 type: 'POST',115 data: {oldPath: path, newPath: _path + value},116 dataType: 'json'117 }).fail(function(jqXHR, textStatus, errorThrown) {118 _showError("Failed moving \"" + path + "\" to \"" + _path + value + "\"", textStatus, errorThrown);119 }).always(function() {120 _reload(_path);121 });122 }123 return value;124 }, {125 onedit: function(settings, original) {126 _disableReloads();127 },128 onsubmit: function(settings, original) {129 _enableReloads();130 },131 onreset: function(settings, original) {132 _enableReloads();133 },134 tooltip: 'Click to rename...'135 });136 137 $(".button-download").click(function(event) {138 var path = $(this).parent().parent().data("path");139 setTimeout(function() {140 window.location = "download?path=" + encodeURIComponent(path);141 }, 0);142 });143 144 $(".button-open").click(function(event) {145 var path = $(this).parent().parent().data("path");146 _reload(path);147 });148 149 $(".button-move").click(function(event) {150 var path = $(this).parent().parent().data("path");151 if (path[path.length - 1] == "/") {152 path = path.slice(0, path.length - 1);153 }154 $("#move-input").data("path", path);155 $("#move-input").val(path);156 $("#move-modal").modal("show");157 });158 159 $(".button-delete").click(function(event) {160 var path = $(this).parent().parent().data("path");161 $.ajax({162 url: 'delete',163 type: 'POST',164 data: {path: path},165 dataType: 'json'166 }).fail(function(jqXHR, textStatus, errorThrown) {167 _showError("Failed deleting \"" + path + "\"", textStatus, errorThrown);168 }).always(function() {169 _reload(_path);170 });171 });172 173 $(document).scrollTop(scrollPosition);174 }).always(function() {175 _enableReloads();176 });177}178179$(document).ready(function() {180 181 // Workaround Firefox and IE not showing file selection dialog when clicking on "upload-file" <button>182 // Making it a <div> instead also works but then it the button doesn't work anymore with tab selection or accessibility183 $("#upload-file").click(function(event) {184 $("#fileupload").click();185 });186 187 // Prevent event bubbling when using workaround above188 $("#fileupload").click(function(event) {189 event.stopPropagation();190 });191 192 $("#fileupload").fileupload({193 dropZone: $(document),194 pasteZone: null,195 autoUpload: true,196 sequentialUploads: true,197 // limitConcurrentUploads: 2,198 // forceIframeTransport: true,199 200 url: 'upload',201 type: 'POST',202 dataType: 'json',203 204 start: function(e) {205 $(".uploading").show();206 },207 208 stop: function(e) {209 $(".uploading").hide();210 },211 212 add: function(e, data) {213 var file = data.files[0];214 data.formData = {215 path: _path216 };217 data.context = $(tmpl("template-uploads", {218 path: _path + file.name219 })).appendTo("#uploads");220 var jqXHR = data.submit();221 data.context.find("button").click(function(event) {222 jqXHR.abort();223 });224 },225 226 progress: function(e, data) {227 var progress = parseInt(data.loaded / data.total * 100, 10);228 data.context.find(".progress-bar").css("width", progress + "%");229 },230 231 done: function(e, data) {232 _reload(_path);233 },234 235 fail: function(e, data) {236 var file = data.files[0];237 if (data.errorThrown != "abort") {238 _showError("Failed uploading \"" + file.name + "\" to \"" + _path + "\"", data.textStatus, data.errorThrown);239 }240 },241 242 always: function(e, data) {243 data.context.remove();244 },245 246 });247 248 $("#create-input").keypress(function(event) {249 if (event.keyCode == ENTER_KEYCODE) {250 $("#create-confirm").click();251 };252 });253 254 $("#create-modal").on("shown.bs.modal", function(event) {255 $("#create-input").focus();256 $("#create-input").select();257 });258 259 $("#create-folder").click(function(event) {260 $("#create-input").val("Untitled folder");261 $("#create-modal").modal("show");262 });263 264 $("#create-confirm").click(function(event) {265 $("#create-modal").modal("hide");266 var name = $("#create-input").val();267 if (name != "") {268 $.ajax({269 url: 'create',270 type: 'POST',271 data: {path: _path + name},272 dataType: 'json'273 }).fail(function(jqXHR, textStatus, errorThrown) {274 _showError("Failed creating folder \"" + name + "\" in \"" + _path + "\"", textStatus, errorThrown);275 }).always(function() {276 _reload(_path);277 });278 }279 });280 281 $("#move-input").keypress(function(event) {282 if (event.keyCode == ENTER_KEYCODE) {283 $("#move-confirm").click();284 };285 });286 287 $("#move-modal").on("shown.bs.modal", function(event) {288 $("#move-input").focus();289 $("#move-input").select();290 })291 292 $("#move-confirm").click(function(event) {293 $("#move-modal").modal("hide");294 var oldPath = $("#move-input").data("path");295 var newPath = $("#move-input").val();296 if ((newPath != "") && (newPath[0] == "/") && (newPath != oldPath)) {297 $.ajax({298 url: 'move',299 type: 'POST',300 data: {oldPath: oldPath, newPath: newPath},301 dataType: 'json'302 }).fail(function(jqXHR, textStatus, errorThrown) {303 _showError("Failed moving \"" + oldPath + "\" to \"" + newPath + "\"", textStatus, errorThrown);304 }).always(function() {305 _reload(_path);306 });307 }308 });309 310 $("#reload").click(function(event) {311 _reload(_path);312 });313 314 _reload("/");315 ...

Full Screen

Full Screen

xpTopicThreadState.jss

Source:xpTopicThreadState.jss Github

copy

Full Screen

...18 viewScope.TopicThread_state.showBodyMap['CURRENT'] = false;19 // 2) open the New Reply area for the current doc20 this._setModifyPosition('CURRENT', 'newReply');21 }22 this._reload = function _reload(dynamicContentArea){23 //<xe:changeDynamicContentAction for="currentDocArea">24 //</xe:changeDynamicContentAction>25 var action:com.ibm.xsp.extlib.actions.server.ChangeDynamicContentAction 26 = new com.ibm.xsp.extlib.actions.server.ChangeDynamicContentAction();27 action.setComponent(view);28 action.setFor(dynamicContentArea);29 action.invoke(facesContext, null);30 };31 this._setModifyPosition = function _setModifyPosition(position, editOrNewReply){32 viewScope.TopicThread_state.modifyPosition = position;33 viewScope.TopicThread_state.modifyEditOrNewReply = editOrNewReply;34 }35 this.changeCurrentHideBody = function changeCurrentHideBody(hide){36 if( hide ){37 viewScope.TopicThread_state.showBodyMap['CURRENT'] = false;38 }else{39 viewScope.TopicThread_state.showBodyMap.remove('CURRENT');40 }41 this._reload('currentDetailArea');42 };43 this.showCurrentNewReply = function changeCurrentNewReply(){44 45 var oldPosition = viewScope.TopicThread_state.modifyPosition;46 var oldEditOrNewReply = viewScope.TopicThread_state.modifyEditOrNewReply;47 48 this._setModifyPosition('CURRENT', 'newReply');49 this._reload('newReplyToCurrentArea');50 this._hideOldModifyArea(oldPosition, oldEditOrNewReply, 'CURRENT', 'newReply');51 };52 this.isPromptChangeEditArea = function isPromptChangeEditArea(){53 return null != viewScope.TopicThread_state.modifyPosition;54 };55 this.clearEditArea = function clearEditArea(){56 var oldPosition = viewScope.TopicThread_state.modifyPosition;57 var oldEditOrNewReply = viewScope.TopicThread_state.modifyEditOrNewReply;58 this._setModifyPosition(null, null);59 this._hideOldModifyArea(oldPosition, oldEditOrNewReply, null, null);60 };61 this.reset = function reset(){62 viewScope.TopicThread_state.modifyPosition = null;63 viewScope.TopicThread_state.modifyEditOrNewReply = null;64 context.reloadPage();65 };66 this._hideOldModifyArea = function _hideOldModifyArea(oldPosition, oldEditOrNewReply,67 newPosition, newEditOrNewReply){68 if( !oldPosition ){69 return;70 }71 // hide previously edited area72 if( 'CURRENT'== oldPosition ){73 if( 'edit' == oldEditOrNewReply ){74 this._reload("currentDocArea");75 }else{ // 'newReply'76 this._reload("newReplyToCurrentArea");77 }78 }else{ // position is a viewEntry position79 if( 'edit' == oldEditOrNewReply ){80 if( 'edit' == newEditOrNewReply ){81 // continue to display rowEditArea82 }else{ 83 // reload to show rowEditArea84 this._reload("rowEditArea");85 }86 // reload the show body area, so the87 // updated body value is reloaded.88 this._reload("rowDetailArea");89 }else{ // 'newReply'90 if( 'newReply' == newEditOrNewReply ){91 // continue to display rowReplyArea92 }else{93 // reload to show rowReplyArea94 this._reload("rowReplyArea");95 }96 }97 }98 }99 this.showCurrentEdit = function showCurrentEdit(){100 var oldPosition = viewScope.TopicThread_state.modifyPosition;101 var oldEditOrNewReply = viewScope.TopicThread_state.modifyEditOrNewReply;102 this._setModifyPosition('CURRENT', 'edit');103 this._reload("currentDocArea");104 this._hideOldModifyArea(oldPosition, oldEditOrNewReply, 'CURRENT', 'edit');105 };106 this._isShowSomeBodyRow = function _isShowSomeBodyRow (){107 var map = viewScope.TopicThread_state.showBodyMap; 108 if(map.isEmpty() || map.size() == 1 && map.containsKey('CURRENT') ){109 return false;110 }111 return true;112 }113 this.changeRowShowBody = function changeRowShowBody(show, row){114 if( show ){115 var oldShowSomeRow = this._isShowSomeBodyRow();116 117 viewScope.TopicThread_state.showBodyMap[row] = true;118 119 if( ! oldShowSomeRow ){120 this._reload("rowDetailArea");121 }122 }else{ //hide123 var removed = viewScope.TopicThread_state.showBodyMap.remove(row);124 if( removed ){125 var newShowSomeRow = this._isShowSomeBodyRow();126 if( !newShowSomeRow ){127 this._reload("rowDetailArea");128 }129 }// was not shown130 }131 };132 this.deleteRow = function deleteRow(row){133 this.changeRowShowBody(false, row);134 }135 this.showRowNewReply = function changeRowNewReply(row, showRowBody){136 // May be doing 2 actions: 137 // A) create new reply 138 // B) show current row body139 140 // A141 var oldPosition = viewScope.TopicThread_state.modifyPosition;142 var oldEditOrNewReply = viewScope.TopicThread_state.modifyEditOrNewReply;143 this._setModifyPosition(row, 'newReply');144 145 // B146 var oldShowSomeRow = this._isShowSomeBodyRow();147 viewScope.TopicThread_state.showBodyMap[row] = true;148 149 // A - show rowReplyArea if needed150 if( oldEditOrNewReply == 'newReply' && 'CURRENT' != oldPosition ){151 // already shown152 }else{153 this._reload("rowReplyArea");154 } 155 // A - hide previously edited area156 this._hideOldModifyArea(oldPosition, oldEditOrNewReply, row, 'newReply');157 // B - show current row if needed158 if( ! oldShowSomeRow ){159 this._reload("rowDetailArea");160 }161 };162 this.showRowEdit = function showRowEdit(row){163 var oldPosition = viewScope.TopicThread_state.modifyPosition;164 var oldEditOrNewReply = viewScope.TopicThread_state.modifyEditOrNewReply;165 this._setModifyPosition(row, 'edit');166 167 // reload rowEditArea168 // [Note if( oldEditRow && 'CURRENT' != oldEditRow )169 // then the row edit area will already be visible,170 // but reload it anyway to re-evaluate the load-time 171 // bindings - specifically to ensure the formName172 // is recalculated.]173 this._reload("rowEditArea");174 175 this._hideOldModifyArea(oldPosition, oldEditOrNewReply, row, 'edit');176 };177 this.isCurrentHideBody = function isCurrentHideBody(){178 return viewScope.TopicThread_state.showBodyMap.containsKey('CURRENT');179 };180 this.isCurrentNewReply = function isCurrentNewReply(){181 return 'CURRENT' == viewScope.TopicThread_state.modifyPosition182 && 'newReply' == viewScope.TopicThread_state.modifyEditOrNewReply;183 };184 this.isCurrentEdit = function isCurrentEdit(){185 return 'CURRENT' == viewScope.TopicThread_state.modifyPosition186 && 'edit' == viewScope.TopicThread_state.modifyEditOrNewReply;187 };...

Full Screen

Full Screen

longinus.js

Source:longinus.js Github

copy

Full Screen

1const floatc2 = this.global.funcs.floatc2;2var colors = [Color.valueOf("ff9c5a66"), Color.valueOf("ff9c5a"), Color.white];3const longinusSpear = new JavaAdapter(BulletType, {4 tscales: [1, 0.7, 0.5, 0.2],5 lenscales: [1, 1.05, 1.065, 1.067],6 strokes: [1.5, 1, 0.3],7 length: 240,8 range() {9 return this.length;10 },11 init(b) {12 if(b == null) return;13 Damage.collideLine(b, b.getTeam(), this.hitEffect, b.x + 3 * Mathf.sinDeg(b.rot()), b.y + 3 * Mathf.cosDeg(b.rot()), b.rot(), this.length, true);14 Damage.collideLine(b, b.getTeam(), this.hitEffect, b.x - 3 * Mathf.sinDeg(b.rot()), b.y - 3 * Mathf.cosDeg(b.rot()), b.rot(), this.length, true);15 },16 draw(b) {17 var f = Mathf.curve(b.fin(), 0, 0.2);18 var baseLen = this.length * f;19 Lines.lineAngle(b.x, b.y, b.rot(), baseLen);20 for(var s = 0; s < 3; s++) {21 Draw.color(colors[s]);22 for(var i = 0; i < 4; i++) {23 Lines.stroke(11 * b.fout() * this.strokes[s] * this.tscales[i]);24 Lines.lineAngle(b.x, b.y, b.rot(), baseLen * this.lenscales[i]);25 }26 }27 Draw.reset();28 }29}, 0.001, 800);30longinusSpear.hitEffect = Fx.hitLancer;31longinusSpear.despawnEffect = Fx.none;32longinusSpear.hitSize = 4;33longinusSpear.pierce = true;34longinusSpear.collidesTiles = false;35longinusSpear.lifetime = 1636longinusSpear.drawSize = 440;37longinusSpear.keepVelocity = false;38const longinusWeapon = extend(Weapon, {39 update(shooter, pointerX, pointerY) {40 shooter.beginReload();41 },42 updateLaser(shooter, pointerX, pointerY) {43 Tmp.v1.trns(shooter.rotation, 16);44 this.shoot(shooter, Tmp.v1.x, Tmp.v1.y, shooter.rotation, true);45 }46});47longinusWeapon.bullet = longinusSpear;48longinusWeapon.reload = 240;49longinusWeapon.alternate = false;50longinusWeapon.inaccuracy = 0;51longinusWeapon.shootSound = Sounds.laser;52const longinusMissile = new JavaAdapter(MissileBulletType, {53 init(b) {},54 update(b) {55 if(b == null || b.time() < 30) return;56 if(b.getData() == null) b.setData(Units.closestTarget(b.getTeam(), b.x, b.y, 240, boolf(e => true)));57 else b.velocity().setAngle(Mathf.slerpDelta(b.velocity().angle(), b.angleTo(b.getData()), 0.08));58 if(Mathf.chance(Time.delta() * 0.2)) Effects.effect(Fx.missileTrail, this.trailColor, b.x, b.y, 2);59 }60}, 2.4, 20, "missile");61longinusMissile.bulletWidth = 8;62longinusMissile.bulletHeight = 8;63longinusMissile.bulletShrink = 0;64longinusMissile.drag = -0.04;65longinusMissile.splashDamageRadius = 30;66longinusMissile.splashDamage = 7;67longinusMissile.lifetime = 120;68longinusMissile.hitEffect = Fx.blastExplosion;69longinusMissile.despawnEffect = Fx.blastExplosion;70longinusInterceptor = extend(Weapon, {71 offsets: [new Vec2(-15, -24), new Vec2(-13, -22), new Vec2(-11, -20), new Vec2(-9, -18), new Vec2(9, -18), new Vec2(11, -20), new Vec2(13, -22), new Vec2(15, -24)],72 updateMissile(shooter, i) {73 var current = this.offsets[i];74 Tmp.v1.trns(shooter.rotation - 90, current.x, current.y);75 this.shoot(shooter, Tmp.v1.x, Tmp.v1.y, shooter.rotation + 30 * Mathf.sign(3.5 - i) + 6 * (3.5 - i), false);76 },77});78longinusInterceptor.bullet = longinusMissile;79longinusInterceptor.alternate = false;80longinusInterceptor.shootSound = Sounds.missile;81const longinus = new UnitType("longinus");82longinus.create(prov(() => new JavaAdapter(HoverUnit, {83 missileSequence: 0,84 _beginReload: false,85 last: 0,86 beginReload() {87 this._beginReload = true;88 },89 _reload: 0,90 _target: null,91 fired: false,92 isCharging: false,93 get_Target() {94 return this._target;95 },96 getTarget() {97 return this.target;98 },99 drawWeapons() {},100 draw() {101 this.super$draw();102 Tmp.v1.trns(this.rotation, 16);103 var cx = this.x - Tmp.v1.x * 3.2,104 cy = this.y - Tmp.v1.y * 3.2,105 absin = Mathf.absin(1, 1);106 Draw.color(Color.black);107 Fill.circle(cx, cy, 3 + absin);108 Draw.color(Color.gray);109 Lines.stroke(1);110 Lines.circle(cx, cy, 5 + absin);111 if(this._reload > 0) {112 var fin = this._reload / 240;113 var efout = 1 - fin * 10 % 1;114 var ex = this.x + Tmp.v1.x,115 ey = this.y + Tmp.v1.y;116 Draw.color(Color.white);117 if(this.last < this._reload) Angles.randLenVectors(this.id + Math.floor(fin * 10), 4, efout * (16 + 8 * fin), floatc2((x, y) => Fill.circle(ex + x, ey + y, 1 * efout + fin)));118 for(var i = 0; i < 3; i++) {119 Draw.color(colors[i]);120 Fill.circle(ex, ey, fin * (7 + absin - i));121 }122 }123 Draw.color();124 },125 getWeapon() {126 if(!Vars.net.client()) return this.type.weapon;127 var range = Time.delta() + 0.1;128 //print(this._reload + ': ' + String(this._reload >= 240 - range || this._reload <= range) + " | " + String(this.fired) + " | " + String(this.last < this._reload));129 if((this._reload >= 240 - range || this._reload <= range) && this.isCharging && !this.fired) {130 this.timer.get(1, 0);131 this.fired = true;132 return longinusWeapon;133 } else return longinusInterceptor;134 },135 targetClosest() {136 this.super$targetClosest();137 var newTarget = Units.closestTarget(this.team, this.x, this.y, Math.max(longinusMissile.range(), this.type.range));138 if(newTarget != null) this._target = newTarget;139 },140 updateTargeting() {141 this.super$updateTargeting();142 var t = this._target;143 if(t == null) return;144 if(t instanceof Unit ? (t.isDead() || t.getTeam() == this.team) : t instanceof TileEntity ? t.tile.entity == null : true) this._target = null;145 },146 update() {147 this.last = this._reload;148 this.super$update();149 if(!Vars.net.client()) {150 var fired = false;151 if(this._beginReload) {152 if(this._reload >= longinusWeapon.reload) {153 if(this.target != null && this.dst2(this.target) < 240 * 240) {154 fired = true;155 var to = Predict.intercept(this, this.target, longinusSpear.speed);156 this.type.weapon = longinusWeapon;157 longinusWeapon.updateLaser(this, to.x, to.y);158 this._reload = 0;159 this._beginReload = false;160 } else this._reload -= Time.delta() * 0.5;161 } else if(this.target == null) this._reload -= Time.delta();162 else this._reload += Time.delta();163 }164 if(this._target != null && !fired)165 if(this.dst2(this._target) < 288 * 288 && (this.timer.get(2, 64) || (this.missileSequence % 4 != 0 && this.timer.get(3, 6)))) {166 this.type.weapon = longinusInterceptor;167 longinusInterceptor.updateMissile(this, this.missileSequence);168 this.type.weapon = longinusWeapon;169 this.missileSequence++;170 if(this.missileSequence > 7) this.missileSequence = 0;171 }172 } else {173 if(this.fired && this.timer.get(1, 120)) this.fired = false;174 this.updateTargeting();175 if(Units.invalidateTarget(this.target, this.team, this.x, this.y)) this.target = null;176 if(this.retarget()) {177 this.targetClosest();178 if(this.target == null) this.targetClosestEnemyFlag(BlockFlag.producer);179 if(this.target == null) this.targetClosestEnemyFlag(BlockFlag.turret);180 }181 if(this._reload > 0) {182 if(this._reload >= longinusWeapon.reload) {183 if(this.target == null || this.dst2(this.target) > 240 * 240) this._reload -= Time.delta() * 0.5;184 else this.isCharging = true;185 } else if(this.target == null) this._reload -= Time.delta();186 else {187 this._reload += Time.delta();188 this.isCharging = true;189 }190 }191 }192 },193 write(data) {194 this.super$write(data);195 data.writeFloat(this._reload);196 data.writeInt(this.missileSequence);197 },198 read(data) {199 this.super$read(data);200 this.last = this._reload;201 this._reload = data.readFloat();202 this.missileSequence = data.readInt();203 }204})));...

Full Screen

Full Screen

dev-client.js

Source:dev-client.js Github

copy

Full Screen

...29var _reload = Reload._reload30Reload._reload = function (options) {31 // Disable original reload for autoupdate package32 if (Reload._reload.caller.name !== '' && Reload._reload.caller.name !== 'checkNewVersionDocument') {33 _reload(options)34 }35}36// Custom reload method37function reload (options) {38 console.log('[HMR] Reload request received')39 if (_deferReload !== 0) {40 setTimeout(_reload, _deferReload)41 console.log(`[HMR] Client reload defered, will reload in ${_deferReload} ms`)42 } else if (_suppressNextReload) {43 console.log(`[HMR] Client version changed, you may need to reload the page`)44 } else {45 console.log(`[HMR] Reloading app...`)46 _reload.call(Reload, options)47 }...

Full Screen

Full Screen

treatConfig.js

Source:treatConfig.js Github

copy

Full Screen

1// guild : Discord.Guild, config : Object2function treatConfig(guild, config)3{4 config._guild = guild;5 config._path = dClient.libs.join(__data, "guilds", guild.id, "config.json");6 Object.defineProperty(config, "raw", { get: function()7 {8 let shallowCopy = Object.assign({}, config);9 delete shallowCopy._guild;10 delete shallowCopy._path;11 delete shallowCopy._save;12 delete shallowCopy._saveSync;13 delete shallowCopy._reload;14 return shallowCopy;15 }, configurable: true });16 // Object : data, Boolean : merge17 config._save = function(data = null, merge = true)18 {19 return new Promise(function(resolve, reject)20 {21 let _guild = config._guild;22 let _path = config._path;23 let _save = config._save;24 let _saveSync = config._saveSync;25 let _reload = config._reload;26 if (data !== null)27 {28 if (merge)29 {30 config = Object.assign(config, data);31 data = config;32 } else config = data;33 } else data = config;34 if (data._guild) delete data._guild;35 if (data._path) delete data._path;36 if (data._save) delete data._save;37 if (data._saveSync) delete data._saveSync;38 if (data._reload) delete data._reload;39 if (data.raw) delete data.raw;40 dClient.libs.fs.outputJson(_path, data, { spaces: 2 }).then(function()41 {42 config = data;43 config.raw = JSON.parse(JSON.stringify(data));44 _guild.config = config;45 config._guild = _guild;46 config._path = _path;47 config._save = _save;48 config._saveSync = _saveSync;49 config._reload = _reload;50 resolve();51 }).catch(reject);52 });53 };54 config._saveSync = function(data = null, merge = true)55 {56 let _guild = config._guild;57 let _path = config._path;58 let _save = config._save;59 let _saveSync = config._saveSync;60 let _reload = config._reload;61 if (data !== null)62 {63 if (merge)64 {65 config = Object.assign(config, data);66 data = config;67 } else config = data;68 } else data = config;69 if (data._guild) delete data._guild;70 if (data._path) delete data._path;71 if (data._save) delete data._save;72 if (data._saveSync) delete data._saveSync;73 if (data._reload) delete data._reload;74 if (data.raw) delete data.raw;75 dClient.libs.fs.outputJsonSync(_path, data, { spaces: 2 });76 config = data;77 config.raw = JSON.parse(JSON.stringify(data));78 _guild.config = config;79 config._guild = _guild;80 config._path = _path;81 config._save = _save;82 config._saveSync = _saveSync;83 config._reload = _reload;84 };85 config._reload = function()86 {87 return new Promise(function(resolve, reject)88 {89 dClient.libs.fs.readJson(config._path).then(function(data)90 {91 let intermediateVars = {92 _guild: config._guild,93 _path: config._path,94 _save: config._save,95 _saveSync: config._saveSync,96 _reload: config._reload97 };98 config = data;99 config = Object.assign(config, intermediateVars);100 resolve(config);101 }).catch(reject);102 });103 };104 return config;105}...

Full Screen

Full Screen

client_refresh.js

Source:client_refresh.js Github

copy

Full Screen

...46 if (!this.call('bus_service', 'isMasterTab') || session.uid !== message.uid && 47 action && controller && controller.widget.modelName === message.model && 48 controller.widget.mode === "readonly") {49 if(controller.widget.isMultiRecord && (message.create || _.intersection(message.ids, action.env.ids) >= 1)) {50 this._reload(message, controller);51 } else if(!controller.widget.isMultiRecord && message.ids.includes(action.env.currentId)) {52 this._reload(message, controller);53 }54 }55 },56 _reload: function(message, controller) {57 if(controller && controller.widget) {58 controller.widget.reload();59 }60 },61});...

Full Screen

Full Screen

script.js

Source:script.js Github

copy

Full Screen

1;(function( $ ){2 "use strict";3 window.app.init = function ($scope) {4 /* -> _config._preload = Load this functions first */5 if (_cfg['_preload']) {6 $.each( _cfg['_preload'], function( _key, _val ){7 if( typeof _val == 'boolean' && typeof window.app[_key] == 'function' ){8 window.app[_key]($scope);9 }10 });11 }12 /* -> _config = Load all others (not _preload and _reload) */13 $.each( _cfg, function( _key, _val ){14 if( ( typeof _val == 'boolean' && typeof window.app[_key] == 'function' && _key != '_reload' && _key != '_preload' ) ){15 window.app[_key]($scope);16 }17 });18 /* -> _config._reload = Load the ajaxInclued and others after the rest */19 if (_cfg['_reload']) {20 $.each( _cfg['_reload'], function( _key, _val ){21 if( ( typeof _val == 'boolean' && typeof window.app[_key] == 'function' ) ){22 window.app[_key]($scope);23 }24 });25 }26 };27 $(document).ready(function() {28 window.app.init($('body'));29 });...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chromium } = require('playwright');2(async () => {3 const browser = await chromium.launch();4 const context = await browser.newContext();5 const page = await context.newPage();6 await page.screenshot({ path: `example.png` });7 await browser.close();8})();9const { chromium } = require('playwright');10(async () => {11 const browser = await chromium.launch();12 const context = await browser.newContext();13 const page = await context.newPage();14 await page.screenshot({ path: `example.png` });15 await page._reload();16 await page.screenshot({ path: `example2.png` });17 await browser.close();18})();19const { chromium } = require('playwright');20(async () => {21 const browser = await chromium.launch();22 const context = await browser.newContext();23 const page = await context.newPage();24 await page.screenshot({ path: `example.png` });25 await page._reload();26 await page.screenshot({ path: `example2.png` });27 await page._reload();28 await page.screenshot({ path: `example3.png` });29 await browser.close();30})();31I'm trying to use _reload() to reload a page that is waiting for a request to finish. When I call _reload(), the page finishes the request and then reloads the page. I would like it to reload the page before the request finishes. Is there a way to do this?32@aslushnikov I tried that, but it didn't work. I think it is because of the way I am using it. I am using it to reload a page that is waiting for a request to finish. When I call _reload(), the page finishes the request and then reloads the page. I would like it to reload the page before the request finishes. Is there a way to do this?

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chromium } = require('playwright');2(async () => {3 const browser = await chromium.launch();4 const context = await browser.newContext();5 const page = await context.newPage();6 await context._reload();7 await browser.close();8})();9const { chromium } = require('playwright');10(async () => {11 const browser = await chromium.launch();12 const context = await browser.newContext();13 const page = await context.newPage();14 await context._reload();15 await browser.close();16})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chromium } = require('playwright');2(async () => {3 const browser = await chromium.launch();4 const context = await browser.newContext();5 const page = await context.newPage();6 await page._reload();7 await browser.close();8})();9const { chromium } = require('playwright');10(async () => {11 const browser = await chromium.launch();12 const context = await browser.newContext();13 const page = await context.newPage();14 await page._reload();15 await browser.close();16})();17const { chromium } = require('playwright');18(async () => {19 const browser = await chromium.launch();20 const context = await browser.newContext();21 const page = await context.newPage();22 await page._reload();23 await browser.close();24})();25const { chromium } = require('playwright');26(async () => {27 const browser = await chromium.launch();28 const context = await browser.newContext();29 const page = await context.newPage();30 await page._reload();31 await browser.close();32})();33const { chromium } = require('playwright');34(async () => {35 const browser = await chromium.launch();36 const context = await browser.newContext();37 const page = await context.newPage();38 await page._reload();39 await browser.close();40})();41const { chromium } = require('playwright');42(async () => {43 const browser = await chromium.launch();44 const context = await browser.newContext();45 const page = await context.newPage();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { _reload } = require('playwright/lib/server/browserType');2const { chromium } = require('playwright');3(async () => {4 const browser = await chromium.launch();5 const context = await browser.newContext();6 const page = await context.newPage();7 await _reload(page);8})();9const { _reload } = require('playwright/lib/server/browserType');10const { chromium } = require('playwright');11(async () => {12 const browser = await chromium.launch();13 const context = await browser.newContext();14 const page = await context.newPage();15 await _reload(page);16})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const pw = require('playwright');2(async () => {3 const browser = await pw.chromium.launch();4 const page = await browser.newPage();5 await page.waitForSelector('h1');6 await page._reload();7 await page.waitForSelector('h1');8 await browser.close();9})();10const pw = require('playwright');11(async () => {12 const browser = await pw.chromium.launch();13 const page = await browser.newPage();14 await page.waitForSelector('h1');15 await page._reload();16 await page.waitForSelector('h1');17 await browser.close();18})();19const pw = require('playwright');20(async () => {21 const browser = await pw.chromium.launch();22 const page = await browser.newPage();23 await page.waitForSelector('h1');24 await page._reload();25 await page.waitForSelector('h1');26 await browser.close();27})();28[api] [error] Error: Protocol error (Page.reload): Cannot navigate to invalid URL29 at async Promise.all (index 0)30 at async ProgressController.run (/Users/username/Projects/playwright-test/node_modules/playwright/lib/server/cjs/utils/progress.js:72:28)31 at async Page.reload (/Users/username/Projects/playwright-test/node_modules/playwright/lib/server/cjs/chromium/crPage.js:101:5)32 at async Object._reload (/Users/username/Projects/playwright-test/node_modules/playwright/lib/server/cjs/chromium/crPage.js:123:5)33 at async Page._reload (/Users/username/Projects/playwright-test/node_modules/playwright/lib/server/cjs/chromium/crPage.js

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chromium } = require("playwright");2(async () => {3 const browser = await chromium.launch();4 const context = await browser.newContext();5 const page = await context.newPage();6 await page._reload();7 await page.screenshot({ path: `example.png` });8 await browser.close();9})();10const { chromium } = require("playwright");11(async () => {12 const browser = await chromium.launch();13 const context = await browser.newContext();14 const page = await context.newPage();15 await page._reload();16 await page.screenshot({ path: `example.png` });17 await browser.close();18})();19const { chromium } = require("playwright");20(async () => {21 const browser = await chromium.launch();22 const context = await browser.newContext();23 const page = await context.newPage();24 await page._reload();25 await page.screenshot({ path: `example.png` });26 await browser.close();27})();28const { chromium } = require("playwright");29(async () => {30 const browser = await chromium.launch();31 const context = await browser.newContext();32 const page = await context.newPage();33 await page._reload();34 await page.screenshot({ path: `example.png` });35 await browser.close();36})();37const { chromium } = require("playwright");38(async () => {39 const browser = await chromium.launch();40 const context = await browser.newContext();41 const page = await context.newPage();42 await page._reload();43 await page.screenshot({ path: `example.png` });44 await browser.close();45})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chromium } = require('playwright-chromium');2const { _reload } = require('playwright-chromium/lib/server/chromium.js');3(async () => {4 const browser = await chromium.launch();5 const page = await browser.newPage();6 await _reload();7 await browser.close();8})();9const { chromium } = require('playwright-chromium');10const { _reload } = require('playwright-chromium/lib/server/chromium.js');11(async () => {12 const browser = await chromium.launch();13 const page = await browser.newPage();14 await _reload();15 await browser.close();16})();17const { chromium } = require('playwright-chromium');18const { _reload } = require('playwright-chromium/lib/server/chromium.js');19(async () => {20 const browser = await chromium.launch();21 const page = await browser.newPage();22 await _reload();23 await browser.close();24})();25const { chromium } = require('playwright-chromium');26const { _reload } = require('playwright-chromium/lib/server/chromium.js');27(async () => {28 const browser = await chromium.launch();29 const page = await browser.newPage();30 await _reload();31 await browser.close();32})();33const { chromium } = require('playwright-chromium');34const { _reload } = require('playwright-chromium/lib/server/chromium.js');35(async () => {36 const browser = await chromium.launch();37 const page = await browser.newPage();38 await _reload();39 await browser.close();40})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { _reload } = require('@playwright/test/lib/server/traceViewer/traceModel');2const { chromium } = require('playwright');3(async () => {4 const browser = await chromium.launch({ headless: false });5 const context = await browser.newContext();6 const page = await context.newPage();7 await page.screenshot({ path: 'example.png' });8 await browser.close();9})();10const { _reload } = require('@playwright/test/lib/server/traceViewer/traceModel');11const { chromium } = require('playwright');12(async () => {13 const browser = await chromium.launch({ headless: false });14 const context = await browser.newContext();15 const page = await context.newPage();16 await page.screenshot({ path: 'example.png' });17 await browser.close();18})();19const { _reload } = require('@playwright/test/lib/server/traceViewer/traceModel');20const { chromium } = require('playwright');21(async () => {22 const browser = await chromium.launch({ headless: false });23 const context = await browser.newContext();24 const page = await context.newPage();25 await page.screenshot({ path: 'example.png' });26 await browser.close();27})();28const { _reload } = require('@playwright/test/lib/server/traceViewer/traceModel');29const { chromium } = require('playwright');30(async () => {31 const browser = await chromium.launch({ headless: false });32 const context = await browser.newContext();33 const page = await context.newPage();34 await page.screenshot({ path: 'example.png' });35 await browser.close();36})();37const { _reload } = require('@playwright/test/lib/server/traceViewer/traceModel');38const { chromium } = require('playwright');39(async () => {40 const browser = await chromium.launch({ headless: false });41 const context = await browser.newContext();42 const page = await context.newPage();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { Playwright } = require('playwright');2const { Page } = require('playwright/lib/server/page');3async function main() {4 const browser = await Playwright.createBrowser();5 const page = await browser.newPage();6 const pageInternal = Page.from(page);7 await pageInternal._reload();8}9main();

Full Screen

Playwright tutorial

LambdaTest’s Playwright tutorial will give you a broader idea about the Playwright automation framework, its unique features, and use cases with examples to exceed your understanding of Playwright testing. This tutorial will give A to Z guidance, from installing the Playwright framework to some best practices and advanced concepts.

Chapters:

  1. What is Playwright : Playwright is comparatively new but has gained good popularity. Get to know some history of the Playwright with some interesting facts connected with it.
  2. How To Install Playwright : Learn in detail about what basic configuration and dependencies are required for installing Playwright and run a test. Get a step-by-step direction for installing the Playwright automation framework.
  3. Playwright Futuristic Features: Launched in 2020, Playwright gained huge popularity quickly because of some obliging features such as Playwright Test Generator and Inspector, Playwright Reporter, Playwright auto-waiting mechanism and etc. Read up on those features to master Playwright testing.
  4. What is Component Testing: Component testing in Playwright is a unique feature that allows a tester to test a single component of a web application without integrating them with other elements. Learn how to perform Component testing on the Playwright automation framework.
  5. Inputs And Buttons In Playwright: Every website has Input boxes and buttons; learn about testing inputs and buttons with different scenarios and examples.
  6. Functions and Selectors in Playwright: Learn how to launch the Chromium browser with Playwright. Also, gain a better understanding of some important functions like “BrowserContext,” which allows you to run multiple browser sessions, and “newPage” which interacts with a page.
  7. Handling Alerts and Dropdowns in Playwright : Playwright interact with different types of alerts and pop-ups, such as simple, confirmation, and prompt, and different types of dropdowns, such as single selector and multi-selector get your hands-on with handling alerts and dropdown in Playright testing.
  8. Playwright vs Puppeteer: Get to know about the difference between two testing frameworks and how they are different than one another, which browsers they support, and what features they provide.
  9. Run Playwright Tests on LambdaTest: Playwright testing with LambdaTest leverages test performance to the utmost. You can run multiple Playwright tests in Parallel with the LammbdaTest test cloud. Get a step-by-step guide to run your Playwright test on the LambdaTest platform.
  10. Playwright Python Tutorial: Playwright automation framework support all major languages such as Python, JavaScript, TypeScript, .NET and etc. However, there are various advantages to Python end-to-end testing with Playwright because of its versatile utility. Get the hang of Playwright python testing with this chapter.
  11. Playwright End To End Testing Tutorial: Get your hands on with Playwright end-to-end testing and learn to use some exciting features such as TraceViewer, Debugging, Networking, Component testing, Visual testing, and many more.
  12. Playwright Video Tutorial: Watch the video tutorials on Playwright testing from experts and get a consecutive in-depth explanation of Playwright automation testing.

Run Playwright Internal 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