Best JavaScript code snippet using playwright-internal
blanket.js
Source:blanket.js
...591 }592 function Y() {593 var a, b = [];594 for (a = nc, R("["); !T("]");) T(",") ? (J(), b.push(null)) : (b.push(pb()), T("]") || R(","));595 return J(), mc.markEnd(mc.createArrayExpression(b), a)596 }597 function Z(a, b) {598 var c, d, e;599 return c = hc, e = nc, d = Qb(), b && hc && l(a[0].name) && P(b, dc.StrictParamName), hc = c, mc.markEnd(mc.createFunctionExpression(null, a, [], d), e)600 }601 function $() {602 var a, b;603 return b = nc, a = J(), a.type === $b.StringLiteral || a.type === $b.NumericLiteral ? (hc && a.octal && P(a, dc.StrictOctalLiteral), mc.markEnd(mc.createLiteral(a), b)) : mc.markEnd(mc.createIdentifier(a.value), b)604 }605 function _() {606 var a, b, c, d, e, f;607 return a = nc, f = nc, a.type === $b.Identifier ? (c = $(), "get" !== a.value || T(":") ? "set" !== a.value || T(":") ? (R(":"), d = pb(), mc.markEnd(mc.createProperty("init", c, d), f)) : (b = $(), R("("), a = nc, a.type !== $b.Identifier ? (R(")"), P(a, dc.UnexpectedToken, a.value), d = Z([])) : (e = [tb()], R(")"), d = Z(e, a)), mc.markEnd(mc.createProperty("set", b, d), f)) : (b = $(), R("("), R(")"), d = Z([]), mc.markEnd(mc.createProperty("get", b, d), f))) : a.type !== $b.EOF && a.type !== $b.Punctuator ? (b = $(), R(":"), d = pb(), mc.markEnd(mc.createProperty("init", b, d), f)) : void Q(a)608 }609 function ab() {610 var a, b, c, d, e, f = [],611 g = {}, h = String;612 for (e = nc, R("{"); !T("}");) a = _(), b = a.key.type === bc.Identifier ? a.key.name : h(a.key.value), d = "init" === a.kind ? cc.Data : "get" === a.kind ? cc.Get : cc.Set, c = "$" + b, Object.prototype.hasOwnProperty.call(g, c) ? (g[c] === cc.Data ? hc && d === cc.Data ? P({}, dc.StrictDuplicateProperty) : d !== cc.Data && P({}, dc.AccessorDataProperty) : d === cc.Data ? P({}, dc.AccessorDataProperty) : g[c] & d && P({}, dc.AccessorGetSet), g[c] |= d) : g[c] = d, f.push(a), T("}") || R(",");613 return R("}"), mc.markEnd(mc.createObjectExpression(f), e)614 }615 function bb() {616 var a;617 return R("("), a = qb(), R(")"), a618 }619 function cb() {620 var a, b, c, d;621 if (T("(")) return bb();622 if (T("[")) return Y();623 if (T("{")) return ab();624 if (a = nc.type, d = nc, a === $b.Identifier) c = mc.createIdentifier(J().value);625 else if (a === $b.StringLiteral || a === $b.NumericLiteral) hc && nc.octal && P(nc, dc.StrictOctalLiteral), c = mc.createLiteral(J());626 else if (a === $b.Keyword) {627 if (U("function")) return Tb();628 U("this") ? (J(), c = mc.createThisExpression()) : Q(J())629 } else a === $b.BooleanLiteral ? (b = J(), b.value = "true" === b.value, c = mc.createLiteral(b)) : a === $b.NullLiteral ? (b = J(), b.value = null, c = mc.createLiteral(b)) : T("/") || T("/=") ? (c = mc.createLiteral("undefined" != typeof pc.tokens ? E() : D()), K()) : Q(J());630 return mc.markEnd(c, d)631 }632 function db() {633 var a = [];634 if (R("("), !T(")"))635 for (; lc > ic && (a.push(pb()), !T(")"));) R(",");636 return R(")"), a637 }638 function eb() {639 var a, b;640 return b = nc, a = J(), F(a) || Q(a), mc.markEnd(mc.createIdentifier(a.value), b)641 }642 function fb() {643 return R("."), eb()644 }645 function gb() {646 var a;647 return R("["), a = qb(), R("]"), a648 }649 function hb() {650 var a, b, c;651 return c = nc, S("new"), a = jb(), b = T("(") ? db() : [], mc.markEnd(mc.createNewExpression(a, b), c)652 }653 function ib() {654 var a, b, c, d, e;655 for (e = nc, a = oc.allowIn, oc.allowIn = !0, b = U("new") ? hb() : cb(), oc.allowIn = a;;) {656 if (T(".")) d = fb(), b = mc.createMemberExpression(".", b, d);657 else if (T("(")) c = db(), b = mc.createCallExpression(b, c);658 else {659 if (!T("[")) break;660 d = gb(), b = mc.createMemberExpression("[", b, d)661 }662 mc.markEnd(b, e)663 }664 return b665 }666 function jb() {667 var a, b, c, d;668 for (d = nc, a = oc.allowIn, b = U("new") ? hb() : cb(), oc.allowIn = a; T(".") || T("[");) T("[") ? (c = gb(), b = mc.createMemberExpression("[", b, c)) : (c = fb(), b = mc.createMemberExpression(".", b, c)), mc.markEnd(b, d);669 return b670 }671 function kb() {672 var a, b, c = nc;673 return a = ib(), nc.type === $b.Punctuator && (!T("++") && !T("--") || N() || (hc && a.type === bc.Identifier && l(a.name) && P({}, dc.StrictLHSPostfix), X(a) || P({}, dc.InvalidLHSInAssignment), b = J(), a = mc.markEnd(mc.createPostfixExpression(b.value, a), c))), a674 }675 function lb() {676 var a, b, c;677 return nc.type !== $b.Punctuator && nc.type !== $b.Keyword ? b = kb() : T("++") || T("--") ? (c = nc, a = J(), b = lb(), hc && b.type === bc.Identifier && l(b.name) && P({}, dc.StrictLHSPrefix), X(b) || P({}, dc.InvalidLHSInAssignment), b = mc.createUnaryExpression(a.value, b), b = mc.markEnd(b, c)) : T("+") || T("-") || T("~") || T("!") ? (c = nc, a = J(), b = lb(), b = mc.createUnaryExpression(a.value, b), b = mc.markEnd(b, c)) : U("delete") || U("void") || U("typeof") ? (c = nc, a = J(), b = lb(), b = mc.createUnaryExpression(a.value, b), b = mc.markEnd(b, c), hc && "delete" === b.operator && b.argument.type === bc.Identifier && P({}, dc.StrictDelete)) : b = kb(), b678 }679 function mb(a, b) {680 var c = 0;681 if (a.type !== $b.Punctuator && a.type !== $b.Keyword) return 0;682 switch (a.value) {683 case "||":684 c = 1;685 break;686 case "&&":687 c = 2;688 break;689 case "|":690 c = 3;691 break;692 case "^":693 c = 4;694 break;695 case "&":696 c = 5;697 break;698 case "==":699 case "!=":700 case "===":701 case "!==":702 c = 6;703 break;704 case "<":705 case ">":706 case "<=":707 case ">=":708 case "instanceof":709 c = 7;710 break;711 case "in":712 c = b ? 7 : 0;713 break;714 case "<<":715 case ">>":716 case ">>>":717 c = 8;718 break;719 case "+":720 case "-":721 c = 9;722 break;723 case "*":724 case "/":725 case "%":726 c = 11727 }728 return c729 }730 function nb() {731 var a, b, c, d, e, f, g, h, i, j;732 if (a = nc, i = lb(), d = nc, e = mb(d, oc.allowIn), 0 === e) return i;733 for (d.prec = e, J(), b = [a, nc], g = lb(), f = [i, d, g];734 (e = mb(nc, oc.allowIn)) > 0;) {735 for (; f.length > 2 && e <= f[f.length - 2].prec;) g = f.pop(), h = f.pop().value, i = f.pop(), c = mc.createBinaryExpression(h, i, g), b.pop(), a = b[b.length - 1], mc.markEnd(c, a), f.push(c);736 d = J(), d.prec = e, f.push(d), b.push(nc), c = lb(), f.push(c)737 }738 for (j = f.length - 1, c = f[j], b.pop(); j > 1;) c = mc.createBinaryExpression(f[j - 1].value, f[j - 2], c), j -= 2, a = b.pop(), mc.markEnd(c, a);739 return c740 }741 function ob() {742 var a, b, c, d, e;743 return e = nc, a = nb(), T("?") && (J(), b = oc.allowIn, oc.allowIn = !0, c = pb(), oc.allowIn = b, R(":"), d = pb(), a = mc.createConditionalExpression(a, c, d), mc.markEnd(a, e)), a744 }745 function pb() {746 var a, b, c, d, e;747 return a = nc, e = nc, d = b = ob(), V() && (X(b) || P({}, dc.InvalidLHSInAssignment), hc && b.type === bc.Identifier && l(b.name) && P(a, dc.StrictLHSAssignment), a = J(), c = pb(), d = mc.markEnd(mc.createAssignmentExpression(a.value, b, c), e)), d748 }749 function qb() {750 var a, b = nc;751 if (a = pb(), T(",")) {752 for (a = mc.createSequenceExpression([a]); lc > ic && T(",");) J(), a.expressions.push(pb());753 mc.markEnd(a, b)754 }755 return a756 }757 function rb() {758 for (var a, b = []; lc > ic && !T("}") && (a = Ub(), "undefined" != typeof a);) b.push(a);759 return b760 }761 function sb() {762 var a, b;763 return b = nc, R("{"), a = rb(), R("}"), mc.markEnd(mc.createBlockStatement(a), b)764 }765 function tb() {766 var a, b;767 return b = nc, a = J(), a.type !== $b.Identifier && Q(a), mc.markEnd(mc.createIdentifier(a.value), b)768 }769 function ub(a) {770 var b, c, d = null;771 return c = nc, b = tb(), hc && l(b.name) && P({}, dc.StrictVarName), "const" === a ? (R("="), d = pb()) : T("=") && (J(), d = pb()), mc.markEnd(mc.createVariableDeclarator(b, d), c)772 }773 function vb(a) {774 var b = [];775 do {776 if (b.push(ub(a)), !T(",")) break;777 J()778 } while (lc > ic);779 return b780 }781 function wb() {782 var a;783 return S("var"), a = vb(), W(), mc.createVariableDeclaration(a, "var")784 }785 function xb(a) {786 var b, c;787 return c = nc, S(a), b = vb(a), W(), mc.markEnd(mc.createVariableDeclaration(b, a), c)788 }789 function yb() {790 return R(";"), mc.createEmptyStatement()791 }792 function zb() {793 var a = qb();794 return W(), mc.createExpressionStatement(a)795 }796 function Ab() {797 var a, b, c;798 return S("if"), R("("), a = qb(), R(")"), b = Pb(), U("else") ? (J(), c = Pb()) : c = null, mc.createIfStatement(a, b, c)799 }800 function Bb() {801 var a, b, c;802 return S("do"), c = oc.inIteration, oc.inIteration = !0, a = Pb(), oc.inIteration = c, S("while"), R("("), b = qb(), R(")"), T(";") && J(), mc.createDoWhileStatement(a, b)803 }804 function Cb() {805 var a, b, c;806 return S("while"), R("("), a = qb(), R(")"), c = oc.inIteration, oc.inIteration = !0, b = Pb(), oc.inIteration = c, mc.createWhileStatement(a, b)807 }808 function Db() {809 var a, b, c;810 return c = nc, a = J(), b = vb(), mc.markEnd(mc.createVariableDeclaration(b, a.value), c)811 }812 function Eb() {813 var a, b, c, d, e, f, g;814 return a = b = c = null, S("for"), R("("), T(";") ? J() : (U("var") || U("let") ? (oc.allowIn = !1, a = Db(), oc.allowIn = !0, 1 === a.declarations.length && U("in") && (J(), d = a, e = qb(), a = null)) : (oc.allowIn = !1, a = qb(), oc.allowIn = !0, U("in") && (X(a) || P({}, dc.InvalidLHSInForIn), J(), d = a, e = qb(), a = null)), "undefined" == typeof d && R(";")), "undefined" == typeof d && (T(";") || (b = qb()), R(";"), T(")") || (c = qb())), R(")"), g = oc.inIteration, oc.inIteration = !0, f = Pb(), oc.inIteration = g, "undefined" == typeof d ? mc.createForStatement(a, b, c, f) : mc.createForInStatement(d, e, f)815 }816 function Fb() {817 var a, b = null;818 return S("continue"), 59 === gc.charCodeAt(ic) ? (J(), oc.inIteration || O({}, dc.IllegalContinue), mc.createContinueStatement(null)) : N() ? (oc.inIteration || O({}, dc.IllegalContinue), mc.createContinueStatement(null)) : (nc.type === $b.Identifier && (b = tb(), a = "$" + b.name, Object.prototype.hasOwnProperty.call(oc.labelSet, a) || O({}, dc.UnknownLabel, b.name)), W(), null !== b || oc.inIteration || O({}, dc.IllegalContinue), mc.createContinueStatement(b))819 }820 function Gb() {821 var a, b = null;822 return S("break"), 59 === gc.charCodeAt(ic) ? (J(), oc.inIteration || oc.inSwitch || O({}, dc.IllegalBreak), mc.createBreakStatement(null)) : N() ? (oc.inIteration || oc.inSwitch || O({}, dc.IllegalBreak), mc.createBreakStatement(null)) : (nc.type === $b.Identifier && (b = tb(), a = "$" + b.name, Object.prototype.hasOwnProperty.call(oc.labelSet, a) || O({}, dc.UnknownLabel, b.name)), W(), null !== b || oc.inIteration || oc.inSwitch || O({}, dc.IllegalBreak), mc.createBreakStatement(b))823 }824 function Hb() {825 var a = null;826 return S("return"), oc.inFunctionBody || P({}, dc.IllegalReturn), 32 === gc.charCodeAt(ic) && h(gc.charCodeAt(ic + 1)) ? (a = qb(), W(), mc.createReturnStatement(a)) : N() ? mc.createReturnStatement(null) : (T(";") || T("}") || nc.type === $b.EOF || (a = qb()), W(), mc.createReturnStatement(a))827 }828 function Ib() {829 var a, b;830 return hc && (q(), P({}, dc.StrictModeWith)), S("with"), R("("), a = qb(), R(")"), b = Pb(), mc.createWithStatement(a, b)831 }832 function Jb() {833 var a, b, c, d = [];834 for (c = nc, U("default") ? (J(), a = null) : (S("case"), a = qb()), R(":"); lc > ic && !(T("}") || U("default") || U("case"));) b = Pb(), d.push(b);835 return mc.markEnd(mc.createSwitchCase(a, d), c)836 }837 function Kb() {838 var a, b, c, d, e;839 if (S("switch"), R("("), a = qb(), R(")"), R("{"), b = [], T("}")) return J(), mc.createSwitchStatement(a, b);840 for (d = oc.inSwitch, oc.inSwitch = !0, e = !1; lc > ic && !T("}");) c = Jb(), null === c.test && (e && O({}, dc.MultipleDefaultsInSwitch), e = !0), b.push(c);841 return oc.inSwitch = d, R("}"), mc.createSwitchStatement(a, b)842 }843 function Lb() {844 var a;845 return S("throw"), N() && O({}, dc.NewlineAfterThrow), a = qb(), W(), mc.createThrowStatement(a)846 }847 function Mb() {848 var a, b, c;849 return c = nc, S("catch"), R("("), T(")") && Q(nc), a = tb(), hc && l(a.name) && P({}, dc.StrictCatchVariable), R(")"), b = sb(), mc.markEnd(mc.createCatchClause(a, b), c)850 }851 function Nb() {852 var a, b = [],853 c = null;854 return S("try"), a = sb(), U("catch") && b.push(Mb()), U("finally") && (J(), c = sb()), 0 !== b.length || c || O({}, dc.NoCatchOrFinally), mc.createTryStatement(a, [], b, c)855 }856 function Ob() {857 return S("debugger"), W(), mc.createDebuggerStatement()858 }859 function Pb() {860 var a, b, c, d, e = nc.type;861 if (e === $b.EOF && Q(nc), e === $b.Punctuator && "{" === nc.value) return sb();862 if (d = nc, e === $b.Punctuator) switch (nc.value) {863 case ";":864 return mc.markEnd(yb(), d);865 case "(":866 return mc.markEnd(zb(), d)867 }868 if (e === $b.Keyword) switch (nc.value) {869 case "break":870 return mc.markEnd(Gb(), d);871 case "continue":872 return mc.markEnd(Fb(), d);873 case "debugger":874 return mc.markEnd(Ob(), d);875 case "do":876 return mc.markEnd(Bb(), d);877 case "for":878 return mc.markEnd(Eb(), d);879 case "function":880 return mc.markEnd(Sb(), d);881 case "if":882 return mc.markEnd(Ab(), d);883 case "return":884 return mc.markEnd(Hb(), d);885 case "switch":886 return mc.markEnd(Kb(), d);887 case "throw":888 return mc.markEnd(Lb(), d);889 case "try":890 return mc.markEnd(Nb(), d);891 case "var":892 return mc.markEnd(wb(), d);893 case "while":894 return mc.markEnd(Cb(), d);895 case "with":896 return mc.markEnd(Ib(), d)897 }898 return a = qb(), a.type === bc.Identifier && T(":") ? (J(), c = "$" + a.name, Object.prototype.hasOwnProperty.call(oc.labelSet, c) && O({}, dc.Redeclaration, "Label", a.name), oc.labelSet[c] = !0, b = Pb(), delete oc.labelSet[c], mc.markEnd(mc.createLabeledStatement(a, b), d)) : (W(), mc.markEnd(mc.createExpressionStatement(a), d))899 }900 function Qb() {901 var a, b, c, d, e, f, g, h, i, j = [];902 for (i = nc, R("{"); lc > ic && nc.type === $b.StringLiteral && (b = nc, a = Ub(), j.push(a), a.expression.type === bc.Literal);) c = gc.slice(b.start + 1, b.end - 1), "use strict" === c ? (hc = !0, d && P(d, dc.StrictOctalLiteral)) : !d && b.octal && (d = b);903 for (e = oc.labelSet, f = oc.inIteration, g = oc.inSwitch, h = oc.inFunctionBody, oc.labelSet = {}, oc.inIteration = !1, oc.inSwitch = !1, oc.inFunctionBody = !0; lc > ic && !T("}") && (a = Ub(), "undefined" != typeof a);) j.push(a);904 return R("}"), oc.labelSet = e, oc.inIteration = f, oc.inSwitch = g, oc.inFunctionBody = h, mc.markEnd(mc.createBlockStatement(j), i)905 }906 function Rb(a) {907 var b, c, d, e, f, g, h = [];908 if (R("("), !T(")"))909 for (e = {}; lc > ic && (c = nc, b = tb(), f = "$" + c.value, hc ? (l(c.value) && (d = c, g = dc.StrictParamName), Object.prototype.hasOwnProperty.call(e, f) && (d = c, g = dc.StrictParamDupe)) : a || (l(c.value) ? (a = c, g = dc.StrictParamName) : k(c.value) ? (a = c, g = dc.StrictReservedWord) : Object.prototype.hasOwnProperty.call(e, f) && (a = c, g = dc.StrictParamDupe)), h.push(b), e[f] = !0, !T(")"));) R(",");910 return R(")"), {911 params: h,912 stricted: d,913 firstRestricted: a,914 message: g915 }916 }917 function Sb() {918 var a, b, c, d, e, f, g, h, i, j = [];919 return i = nc, S("function"), c = nc, a = tb(), hc ? l(c.value) && P(c, dc.StrictFunctionName) : l(c.value) ? (f = c, g = dc.StrictFunctionName) : k(c.value) && (f = c, g = dc.StrictReservedWord), e = Rb(f), j = e.params, d = e.stricted, f = e.firstRestricted, e.message && (g = e.message), h = hc, b = Qb(), hc && f && O(f, g), hc && d && P(d, g), hc = h, mc.markEnd(mc.createFunctionDeclaration(a, j, [], b), i)920 }921 function Tb() {922 var a, b, c, d, e, f, g, h, i = null,923 j = [];924 return h = nc, S("function"), T("(") || (a = nc, i = tb(), hc ? l(a.value) && P(a, dc.StrictFunctionName) : l(a.value) ? (c = a, d = dc.StrictFunctionName) : k(a.value) && (c = a, d = dc.StrictReservedWord)), e = Rb(c), j = e.params, b = e.stricted, c = e.firstRestricted, e.message && (d = e.message), g = hc, f = Qb(), hc && c && O(c, d), hc && b && P(b, d), hc = g, mc.markEnd(mc.createFunctionExpression(i, j, [], f), h)925 }926 function Ub() {927 if (nc.type === $b.Keyword) switch (nc.value) {928 case "const":929 case "let":930 return xb(nc.value);931 case "function":932 return Sb();933 default:934 return Pb()935 }936 return nc.type !== $b.EOF ? Pb() : void 0937 }938 function Vb() {939 for (var a, b, c, d, e = []; lc > ic && (b = nc, b.type === $b.StringLiteral) && (a = Ub(), e.push(a), a.expression.type === bc.Literal);) c = gc.slice(b.start + 1, b.end - 1), "use strict" === c ? (hc = !0, d && P(d, dc.StrictOctalLiteral)) : !d && b.octal && (d = b);940 for (; lc > ic && (a = Ub(), "undefined" != typeof a);) e.push(a);941 return e942 }943 function Wb() {944 var a, b;945 return q(), K(), b = nc, hc = !1, a = Vb(), mc.markEnd(mc.createProgram(a), b)946 }947 function Xb() {948 var a, b, c, d = [];949 for (a = 0; a < pc.tokens.length; ++a) b = pc.tokens[a], c = {950 type: b.type,951 value: b.value952 }, pc.range && (c.range = b.range), pc.loc && (c.loc = b.loc), d.push(c);953 pc.tokens = d954 }955 function Yb(a, b) {956 var c, d, e;957 c = String, "string" == typeof a || a instanceof String || (a = c(a)), mc = fc, gc = a, ic = 0, jc = gc.length > 0 ? 1 : 0, kc = 0, lc = gc.length, nc = null, oc = {958 allowIn: !0,959 labelSet: {},...
actionsheet.js
Source:actionsheet.js
1/*jshint smarttabs:true, eqeqeq:false, eqnull:true, laxbreak:true*/2/*(function(window, vx, undefined) {'use strict';3var mod = vx.module("ui.libraries");4mod.directive("vActionsheet", ["$os",function($os) {5 var actionsheet = (function() {6 var actionsheet = function(elID, opts, scope) {7 this.el = elID;8 if (this instanceof actionsheet) {9 if(typeof(opts)=="object"){10 for (var j in opts) {11 this[j] = opts[j];12 }13 }14 } else {15 return new actionsheet(elID, opts);16 }17 try {18 var that = this;19 var markStart = '<div id="jq_actionsheet"><div style="width:100%">';20 var markEnd = '</div></div>';21 var markup;22 if (typeof opts == "string") {23 markup = $(markStart + opts +"<a href='javascript:;' class='cancel'>åæ¶</a>"+markEnd);24 } else if (typeof opts == "object") {25 markup = $(markStart + markEnd);26 var container = $(markup.children().get());27 opts.push({text:"åæ¶",cssClasses:"cancel"});28 for (var i = 0; i < opts.length; i++) {29 var item = $('<a href="javascript:;" >' + (opts[i].text || "TEXT NOT ENTERED") + '</a>');30 item[0].onclick = (function(handler){31 return function(){32 scope.$apply(handler);33 }34 })(opts[i].handler);35 if (opts[i].cssClasses && opts[i].cssClasses.length > 0)36 item.addClass(opts[i].cssClasses);37 container.append(item);38 }39 }40 $(elID).find("#jq_actionsheet").remove();41 $(elID).find("#jq_action_mask").remove();42 var actionsheetEl = $(elID).append(markup);43 44 this.el.style.overflow = "hidden";45 markup.on("click", "a",function(){that.hideSheet()});46 this.activeSheet=markup;47 $(elID).append('<div id="jq_action_mask" style="position:absolute;top:0px;left:0px;right:0px;bottom:0px;z-index:9998;background:rgba(0,0,0,.4)"/>');48 } catch (e) {49 console.log("catch error: " + e);50 }51 };52 actionsheet.prototype = {53 activeSheet:null,54 hideSheet: function() {55 var that=this;56 this.activeSheet.off("click","a",function(){that.hideSheet()});57 $(this.el).find("#jq_action_mask").remove();58 // this.activeSheet.get().style[$.feat.cssPrefix+'Transition']="all 0ms";59 var markup = this.activeSheet;60 var theEl = this.el;61 setTimeout(function(){62 // markup.get().style[$.feat.cssPrefix+'Transition']="all 300ms";63 // markup.css($.feat.cssPrefix+"Transform", "translate"+$.feat.cssTransformStart+"0,0px"+$.feat.cssTransformEnd);64 markup.remove();65 markup=null;66 theEl.style.overflow = "none";67 },10); 68 }69 };70 return actionsheet;71 })();72 return {73 restrict: 'A',74 link: function postLink(scope, element, attr){75 element.bind("click",function(e){76 var opts = null;77 opts = vx.copy(scope[attr.vActionsheet]);78 new actionsheet(vx.element("body")[0],opts,scope); 79 });80 }81 }82}]);83})(window, window.vx);*/84/**85 * popup service86 * return {87 * "actionsheet": function(actionJson, scope)88 * }89 * actionJson æ°ç»90 * scope å½åscope91 */92(function(window, vx, undefined) {93 'use strict';94 vx.module('ibsapp')95 .factory('Popup', [function () {96 var actionsheet = (function() {97 var actionsheet = function(elID, opts, scope) {98 this.el = elID;99 if (this instanceof actionsheet) {100 if(typeof(opts)=="object"){101 for (var j in opts) {102 this[j] = opts[j];103 }104 }105 } else {106 return new actionsheet(elID, opts);107 }108 try {109 var that = this;110 var markStart = '<div id="jq_actionsheet"><div style="width:100%">';111 var markEnd = '</div></div>';112 var markup;113 if (typeof opts == "string") {114 markup = $(markStart + opts +"<a href='javascript:;' class='cancel'>åæ¶</a>"+markEnd);115 } else if (typeof opts == "object") {116 markup = $(markStart + markEnd);117 var container = $(markup.children().get());118 opts.push({text:"åæ¶",cssClasses:"cancel"});119 for (var i = 0; i < opts.length; i++) {120 var item = $('<a href="javascript:;" >' + (opts[i].text || "TEXT NOT ENTERED") + '</a>');121 item[0].onclick = (function(handler){122 return function(){123 scope.$apply(handler);124 $("body").css("overflow","");125 }126 })(opts[i].handler);127 if (opts[i].cssClasses && opts[i].cssClasses.length > 0)128 item.addClass(opts[i].cssClasses);129 container.append(item);130 }131 }132 $(elID).find("#jq_actionsheet").remove();133 $(elID).find("#jq_action_mask").remove();134 markup.css("bottom",-(45*opts.length+10)+"px")135 var actionsheetEl = $(elID).append(markup);136 setTimeout(function(){137 markup.css("bottom","0px")138 }, 0);139 140 this.el.style.overflow = "hidden";141 markup.on("click", "a",function(){that.hideSheet()});142 this.activeSheet=markup;143 $(elID).append('<div id="jq_action_mask" style="position:fixed;top:0px;left:0px;right:0px;bottom:0px;z-index:9998;background:rgba(0,0,0,.4)"/>');144 $("#jq_action_mask").bind("touchmove", function(e){ //é»æ¢æ»å¨145 e.preventDefault();146 });147 } catch (e) {148 console.log("catch error: " + e);149 }150 };151 actionsheet.prototype = {152 activeSheet:null,153 hideSheet: function() {154 var that=this;155 this.activeSheet.off("click","a",function(){that.hideSheet()});156 $("#jq_action_mask").unbind("touchmove"); //åæ¶äºä»¶çå¬157 $(this.el).find("#jq_action_mask").remove();158 // this.activeSheet.get().style[$.feat.cssPrefix+'Transition']="all 0ms";159 var markup = this.activeSheet;160 var theEl = this.el;161 setTimeout(function(){162 // markup.get().style[$.feat.cssPrefix+'Transition']="all 300ms";163 // markup.css($.feat.cssPrefix+"Transform", "translate"+$.feat.cssTransformStart+"0,0px"+$.feat.cssTransformEnd);164 markup.remove();165 markup=null;166 theEl.style.overflow = "none";167 },10); 168 }169 };170 return actionsheet;171 })();172 return {173 actionsheet: function(actionJson, scope){174 if(vx.isArray(actionJson)){175 var opts = vx.copy(actionJson);176 new actionsheet(vx.element("body")[0],opts,scope);177 }178 }179 };180 }]);...
arrows-positions.test.js
Source:arrows-positions.test.js
1import { map, pipe } from 'ramda';2import { getArrowsPositions, getArrowsPositionsForMSBN, makeArrowLine } from './arrows-positions';3const TYPE_LEFT = 'left';4const TYPE_RIGHT = 'right';5const TYPE_TOP = 'top';6const TYPE_BOTTOM = 'bottom';7const RAIN_NODE = 'RAIN';8const SPRINKLER_NODE = 'SPRINKLER';9const GRASS_WET_NODE = 'GRASS_WET';10const NETWORK_1 = 'NETWORK_1';11const NETWORK_2 = 'NETWORK_2';12const NETWORK_3 = 'NETWORK_3';13const NETWORK_4 = 'NETWORK_4';14const SIZES = { width: 160, height: 160 };15const mapPostions = (positions = {}) => map(node => ({16 ...node,17 position: positions[node.id],18}));19const mapSize = map(node => ({20 ...node,21 size: SIZES,22}));23const createSprinklerNetworkWithPostionsAndStates = (positions) => {24 const rain = {25 id: RAIN_NODE,26 parents: [],27 };28 const sprinkler = {29 id: SPRINKLER_NODE,30 parents: ['RAIN'],31 };32 const grassWet = {33 id: GRASS_WET_NODE,34 parents: ['RAIN', 'SPRINKLER'],35 };36 return pipe(mapPostions(positions), mapSize)([rain, sprinkler, grassWet]);37};38const createNetworksWithPostions = (positions = {}) => {39 const net1 = {40 id: NETWORK_1,41 };42 const net2 = {43 id: NETWORK_2,44 };45 const net3 = {46 id: NETWORK_3,47 };48 const net4 = {49 id: NETWORK_4,50 };51 return pipe(mapPostions(positions), mapSize)([net1, net2, net3, net4]);52};53describe('Arrows Positions Utils', () => {54 describe('getArrowsPositions', () => {55 const markEnd = true;56 it('When positions are RAIN_NODE { x: 1, y: 200 }, SPRINKLER_NODE: { x: 550, y: 100 } and GRASS_WET_NODE: { x: 200, y: 490 }', () => {57 const positions = {58 [RAIN_NODE]: { x: 1, y: 200 },59 [SPRINKLER_NODE]: { x: 550, y: 100 },60 [GRASS_WET_NODE]: { x: 200, y: 490 },61 };62 const network = createSprinklerNetworkWithPostionsAndStates(positions);63 expect(getArrowsPositions(network)).toEqual([64 {65 childId: SPRINKLER_NODE,66 from: { type: TYPE_RIGHT, x: 161, y: 280 },67 key: `${RAIN_NODE}-${SPRINKLER_NODE}`,68 markEnd,69 parentId: RAIN_NODE,70 to: { type: TYPE_LEFT, x: 550, y: 180 },71 }, {72 childId: GRASS_WET_NODE,73 from: { type: TYPE_BOTTOM, x: 81, y: 360 },74 key: `${RAIN_NODE}-${GRASS_WET_NODE}`,75 markEnd,76 parentId: RAIN_NODE,77 to: { type: TYPE_TOP, x: 280, y: 490 },78 }, {79 childId: GRASS_WET_NODE,80 from: { type: TYPE_BOTTOM, x: 630, y: 260 },81 key: `${SPRINKLER_NODE}-${GRASS_WET_NODE}`,82 markEnd,83 parentId: SPRINKLER_NODE,84 to: { type: TYPE_RIGHT, x: 360, y: 570 },85 },86 ]);87 });88 it('When positions are RAIN_NODE { x: 100, y: 45 }, SPRINKLER_NODE: { x: 1, y: 250 } and GRASS_WET_NODE: { x: 50, y: 100 }', () => {89 const positions = {90 [RAIN_NODE]: { x: 100, y: 45 },91 [SPRINKLER_NODE]: { x: 1, y: 250 },92 [GRASS_WET_NODE]: { x: 50, y: 100 },93 };94 const network = createSprinklerNetworkWithPostionsAndStates(positions);95 expect(getArrowsPositions(network)).toEqual([96 {97 childId: SPRINKLER_NODE,98 from: { type: TYPE_BOTTOM, x: 180, y: 205 },99 key: `${RAIN_NODE}-${SPRINKLER_NODE}`,100 markEnd,101 parentId: RAIN_NODE,102 to: { type: TYPE_TOP, x: 81, y: 250 },103 }, {104 childId: GRASS_WET_NODE,105 from: { type: TYPE_BOTTOM, x: 180, y: 205 },106 key: `${RAIN_NODE}-${GRASS_WET_NODE}`,107 markEnd,108 parentId: RAIN_NODE,109 to: { type: TYPE_RIGHT, x: 210, y: 180 },110 }, {111 childId: GRASS_WET_NODE,112 from: { type: TYPE_TOP, x: 81, y: 250 },113 key: `${SPRINKLER_NODE}-${GRASS_WET_NODE}`,114 markEnd,115 parentId: SPRINKLER_NODE,116 to: { type: TYPE_BOTTOM, x: 130, y: 260 },117 },118 ]);119 });120 });121 describe('getArrowsPositionsForMSBN', () => {122 const markEnd = false;123 const linkagesByTwoNode = [124 { networkId1: NETWORK_2, networkId2: NETWORK_1 },125 { networkId1: NETWORK_3, networkId2: NETWORK_1 },126 { networkId1: NETWORK_4, networkId2: NETWORK_1 },127 ];128 it('When positions are NETWORK_1 { x: 314, y: 224.5 }, NETWORK_2 { x: 326, y: 64.5 }, NETWORK_3 { x: 64, y: 220.5 }, NETWORK_4 { x: 574, y: 216.5 }', () => {129 const positions = {130 [NETWORK_1]: { x: 314, y: 224.5 },131 [NETWORK_2]: { x: 326, y: 64.5 },132 [NETWORK_3]: { x: 64, y: 220.5 },133 [NETWORK_4]: { x: 574, y: 216.5 },134 };135 const networks = createNetworksWithPostions(positions);136 expect(getArrowsPositionsForMSBN(networks, linkagesByTwoNode)).toEqual([{137 networkId1: NETWORK_2,138 networkId2: NETWORK_1,139 from: { type: TYPE_BOTTOM, x: 406, y: 224.5 },140 key: 'NETWORK_2-NETWORK_1',141 markEnd,142 to: { type: TYPE_TOP, x: 394, y: 224.5 },143 }, {144 networkId1: NETWORK_3,145 networkId2: NETWORK_1,146 from: { type: TYPE_RIGHT, x: 224, y: 300.5 },147 key: 'NETWORK_3-NETWORK_1',148 markEnd,149 to: { type: TYPE_LEFT, x: 314, y: 304.5 },150 }, {151 networkId1: NETWORK_4,152 networkId2: NETWORK_1,153 from: { type: TYPE_LEFT, x: 574, y: 296.5 },154 key: 'NETWORK_4-NETWORK_1',155 markEnd,156 to: { type: TYPE_RIGHT, x: 474, y: 304.5 },157 }]);158 });159 });160 describe('makeArrowLine', () => {161 describe('When "n" is 50', () => {162 const n = 50;163 it('When goes from left to right', () => {164 const from = { type: TYPE_RIGHT, x: 100, y: 100 };165 const to = { type: TYPE_LEFT, x: 200, y: 100 };166 expect(makeArrowLine(from, to, n)).toBe('M100,100 C150,100 150,100 200,100');167 });168 it('When goes from right to left', () => {169 const from = { type: TYPE_LEFT, x: 100, y: 100 };170 const to = { type: TYPE_RIGHT, x: 0, y: 100 };171 expect(makeArrowLine(from, to, n)).toBe('M100,100 C50,100 50,100 0,100');172 });173 it('When goes from top to bottom', () => {174 const from = { type: TYPE_BOTTOM, x: 100, y: 100 };175 const to = { type: TYPE_TOP, x: 100, y: 0 };176 expect(makeArrowLine(from, to, n)).toBe('M100,100 C100,150 100,-50 100,0');177 });178 it('When goes from bottom to top', () => {179 const from = { type: TYPE_TOP, x: 100, y: 100 };180 const to = { type: TYPE_BOTTOM, x: 100, y: 200 };181 expect(makeArrowLine(from, to, n)).toBe('M100,100 C100,50 100,250 100,200');182 });183 });184 describe('When "n" is 100', () => {185 const n = 100;186 it('When goes from left to right', () => {187 const from = { type: TYPE_RIGHT, x: 100, y: 100 };188 const to = { type: TYPE_LEFT, x: 200, y: 100 };189 expect(makeArrowLine(from, to, n)).toBe('M100,100 C200,100 100,100 200,100');190 });191 it('When goes from right to left', () => {192 const from = { type: TYPE_LEFT, x: 100, y: 100 };193 const to = { type: TYPE_RIGHT, x: 0, y: 100 };194 expect(makeArrowLine(from, to, n)).toBe('M100,100 C0,100 100,100 0,100');195 });196 it('When goes from top to bottom', () => {197 const from = { type: TYPE_BOTTOM, x: 100, y: 100 };198 const to = { type: TYPE_TOP, x: 100, y: 0 };199 expect(makeArrowLine(from, to, n)).toBe('M100,100 C100,200 100,-100 100,0');200 });201 it('When goes from bottom to top', () => {202 const from = { type: TYPE_TOP, x: 100, y: 100 };203 const to = { type: TYPE_BOTTOM, x: 100, y: 200 };204 expect(makeArrowLine(from, to, n)).toBe('M100,100 C100,0 100,300 100,200');205 });206 });207 });...
perf-util.test.js
Source:perf-util.test.js
...32 it("If it set markName to markEnd then It set markName-end-[index] to mark.", function() {33 // Given34 mock.performance.markStart("foo");35 // When36 mock.performance.markEnd("foo");37 var nameCount = getPerformanceInfo().nameCount;38 var entryList = mock.performance.getEntries({name:"foo-end-1"});39 40 // Then41 expect(nameCount.foo.count).toBe(1);42 expect(entryList.length).toBe(1);43 expect(entryList[0].name).toBe("foo-end-1");44 });45 it("When it don`t set markName to markStart If It called markEnd It should be raise exception.", function() {46 // Given47 // When48 // Then49 expect(function(){50 mock.performance.markEnd("shouldBeException");51 }).toThrowError("You don`t have to same markEnd name.(shouldBeException)");52 });53 afterEach(function() {54 mock.performance.clearMarks();55 mock.performance.clearMeasures();56 });57});58describe("performance.analyzeMark", function() {59 var mock = {}, getPerformanceInfo;60 61 beforeEach(function() {62 mock.performance = window.performance;63 getPerformanceInfo = cache(mock);64 });65 it("analyzeMark have to return info.", function() {66 // Given67 function nonp(){68 for (var i = 0; i < 10000; i++) {69 } 70 };71 for (var i = 0; i < 10; i++) {72 mock.performance.markStart("foo");73 nonp();74 mock.performance.markEnd("foo");75 }76 // When77 var info = mock.performance.analyzeMark("foo");78 // Then79 expect(info.count).toBe(10);80 expect(info.average > 0).toBe(true);81 expect(info.median > 0).toBe(true);82 expect(info.durationList.length).toBe(10);83 });84 afterEach(function() {85 mock.performance.clearMarks();86 mock.performance.clearMeasures();87 });88});89describe("global.performance.searchEntries", function() {90 var mock = {}, getPerformanceInfo;91 92 beforeEach(function() {93 mock.performance = window.performance;94 getPerformanceInfo = cache(mock);95 });96 it("If searchEntries has not parameter then it has to return all entryList.", function() {97 // Given98 function nonp(){99 for (var i = 0; i < 10000; i++) {100 } 101 };102 mock.performance.mark("bar");103 for (var i = 0; i < 10; i++) {104 mock.performance.markStart("foo");105 nonp();106 mock.performance.markEnd("foo");107 }108 mock.performance.mark("baz");109 var allEntryList = mock.performance.getEntries();110 // When111 var info = mock.performance.searchEntries();112 // Then113 expect(info.length).toBe(allEntryList.length);114 });115 it("If searchEntries has name in parameter then it has to return matched entryList.", function() {116 // Given117 function nonp(){118 for (var i = 0; i < 10000; i++) {119 } 120 };121 mock.performance.mark("bar");122 for (var i = 0; i < 10; i++) {123 mock.performance.markStart("foo");124 nonp();125 mock.performance.markEnd("foo");126 }127 mock.performance.mark("baz");128 // When129 var info = mock.performance.searchEntries( {130 "name": /foo/131 } );132 // Then133 expect(info.length).toBe(30);134 });135 it("If searchEntries has name, entryType in parameter then it has to return matched entryList.", function() {136 // Given137 function nonp(){138 for (var i = 0; i < 10000; i++) {139 } 140 };141 mock.performance.mark("bar");142 for (var i = 0; i < 10; i++) {143 mock.performance.markStart("foo");144 nonp();145 mock.performance.markEnd("foo");146 }147 mock.performance.mark("baz");148 // When149 var info = mock.performance.searchEntries( {150 "name": /foo/,151 "entryType": "measure"152 } );153 // Then154 expect(info.length).toBe(10);155 });156 afterEach(function() {157 mock.performance.clearMarks();158 mock.performance.clearMeasures();159 });...
perf-util.js
Source:perf-util.js
1_wrap_ ( function( global ) {2 var nameCount = {};3 function mark( name, type, count ) {4 global.performance.mark( name + "-" + type + "-" + count );5 }6 function average ( values ) {7 return values.reduce( function( a, b ) {8 return a + b;9 } ) / values.length;10 }11 function median( values ) {12 var values = values.sort( function( a, b ) {13 return a - b;14 } );15 var half = Math.floor( values.length / 2 );16 if ( values.length % 2 ) {17 return values[ half ];18 } else {19 return ( values[ half - 1 ] + values[ half ] ) / 2.0;20 }21 }22 /**23 * This method set to start mark.24 * @name performance.markStart25 * @param {String} [name] - name26 */27 global.performance.markStart = function( name ) {28 if ( nameCount[ name ] === undefined ) {29 nameCount[ name ] = {30 "count": 0,31 "isMarkEndCalled": false32 }33 count = 0;34 }35 var count = nameCount[ name ].count;36 nameCount[ name ].count = ++count;37 nameCount[ name ].isMarkEndCalled = false;38 mark( name, "start", nameCount[ name ].count );39 }40 /**41 * This method set to end mark.42 * @name performance.markEnd43 * @param {String} [name] - name44 */45 global.performance.markEnd = function( name ) {46 if ( !nameCount[ name ] || ( nameCount[ name ] && nameCount[ name ].isMarkEndCalled ) ) {47 throw new Error( "You don`t have to same markEnd name.(" + name + ")" );48 } else {49 nameCount[ name ].isMarkEndCalled = true;50 var count = nameCount[ name ].count;51 mark( name, "end", count );52 groupMeasure( name );53 }54 }55 /**56 * This method set to measure.57 * @private58 * @name performance.markEnd59 * @param {String} [name] - name60 */61 function groupMeasure( name ) {62 var count = nameCount[name].count;63 global.performance.measure( name + "-measure-" + count, name + "-start-" + count, name + "-end-" + count );64 }65 /**66 * This method get to analyze to information having count, average, median, durationList.67 * The count is total mark count.68 * The average is average duration of measure69 * The median is median duration of measure70 * The durationList is list of duration.71 * @name performance.markEnd72 * @param {String} [name] - name73 * @return {Array} performanceEntryList74 */75 global.performance.analyzeMark = function( name ) {76 var entryList = global.performance.getEntriesByType( "measure" );77 var durationList = entryList.filter( function( v ) {78 return v.name.indexOf( name + "-measure-" ) > -1;79 } ).map( function( v ) {80 return v.duration;81 } );82 return {83 "count": durationList.length,84 "average": average( durationList ),85 "median": median( durationList ),86 "durationList": durationList87 }88 }89 /**90 * This method search entry. It can use name and entryType.91 * @name performance.searchEntries92 * @param {Object} [PerformanceEntryFilterOptions] - filter93 * @param {String} [PerformanceEntryFilterOptions.entryType] - entryType of PerformanceEntry object.94 * @param {Regexp} [PerformanceEntryFilterOptions.name] - name of PerformanceEntry object.95 * @return {Array} performanceEntryList96 */97 global.performance.searchEntries = function( filter ) {98 if ( !filter ) {99 return global.performance.getEntries();100 }101 var perfEntryList;102 if ( filter.entryType ) {103 perfEntryList = global.performance.getEntriesByType( filter.entryType );104 } else {105 perfEntryList = global.performance.getEntries();106 }107 return perfEntryList.filter( function( entry ) {108 return filter.name.test( entry.name )109 } );110 }111 return function() {112 return {113 "nameCount": nameCount114 }115 }...
stability.mjs
Source:stability.mjs
1// Build stability table to documentation.html/json/md by generated all.json2import fs from 'fs';3import raw from 'rehype-raw';4import htmlStringify from 'rehype-stringify';5import gfm from 'remark-gfm';6import markdown from 'remark-parse';7import remark2rehype from 'remark-rehype';8import { unified } from 'unified';9import { visit } from 'unist-util-visit';10const source = new URL('../../out/doc/api/', import.meta.url);11const data = JSON.parse(fs.readFileSync(new URL('./all.json', source), 'utf8'));12const markBegin = '<!-- STABILITY_OVERVIEW_SLOT_BEGIN -->';13const markEnd = '<!-- STABILITY_OVERVIEW_SLOT_END -->';14const mark = `${markBegin}(.*)${markEnd}`;15const output = {16 json: new URL('./stability.json', source),17 docHTML: new URL('./documentation.html', source),18 docJSON: new URL('./documentation.json', source),19 docMarkdown: new URL('./documentation.md', source),20};21function collectStability(data) {22 const stability = [];23 for (const mod of data.modules) {24 if (mod.displayName && mod.stability >= 0) {25 const link = mod.source.replace('doc/api/', '').replace('.md', '.html');26 stability.push({27 api: mod.name,28 link: link,29 stability: mod.stability,30 stabilityText: `(${mod.stability}) ${mod.stabilityText}`,31 });32 }33 }34 stability.sort((a, b) => a.api.localeCompare(b.api));35 return stability;36}37function createMarkdownTable(data) {38 const md = ['| API | Stability |', '| --- | --------- |'];39 for (const mod of data) {40 md.push(`| [${mod.api}](${mod.link}) | ${mod.stabilityText} |`);41 }42 return md.join('\n');43}44function createHTML(md) {45 const file = unified()46 .use(markdown)47 .use(gfm)48 .use(remark2rehype, { allowDangerousHtml: true })49 .use(raw)50 .use(htmlStringify)51 .use(processStability)52 .processSync(md);53 return file.value.trim();54}55function processStability() {56 return (tree) => {57 visit(tree, { type: 'element', tagName: 'tr' }, (node) => {58 const [api, stability] = node.children;59 if (api.tagName !== 'td') {60 return;61 }62 api.properties.class = 'module_stability';63 const level = stability.children[0].value[1];64 stability.properties.class = `api_stability api_stability_${level}`;65 });66 };67}68function updateStabilityMark(file, value, mark) {69 const fd = fs.openSync(file, 'r+');70 const content = fs.readFileSync(fd, { encoding: 'utf8' });71 const replaced = content.replace(mark, value);72 if (replaced !== content) {73 fs.writeSync(fd, replaced, 0, 'utf8');74 }75 fs.closeSync(fd);76}77const stability = collectStability(data);78// add markdown79const markdownTable = createMarkdownTable(stability);80updateStabilityMark(output.docMarkdown,81 `${markBegin}\n${markdownTable}\n${markEnd}`,82 new RegExp(mark, 's'));83// add html table84const html = createHTML(markdownTable);85updateStabilityMark(output.docHTML, `${markBegin}${html}${markEnd}`,86 new RegExp(mark, 's'));87// add json output88updateStabilityMark(output.docJSON,89 JSON.stringify(`${markBegin}${html}${markEnd}`),...
performanceObserver.worker.js
Source:performanceObserver.worker.js
1importScripts("../support/testharness.js");2importScripts("support/common.js");3promise_test(function(test) {4 return new Promise(function(resolve) {5 cleanup();6 var observer = new PerformanceObserver(function(list) {7 resolve(list);8 test.add_cleanup(function() {9 observer.disconnect();10 });11 });12 observer.observe({entryTypes: ["mark", "measure"]});13 performance.mark("markStart");14 doWork();15 performance.mark("markEnd");16 performance.measure("measure", "markStart", "markEnd");17 18 }).then(function(list) {19 var entries = list.getEntries();20 assert_equals(entries.length, 3,21 "Observed user timing entries should have three entries.");22 });23}, "Performance Observer for Web Workers");24promise_test(function(test) {25 return new Promise(function(resolve) {26 cleanup();27 var observer = new PerformanceObserver(function(list) {28 resolve(list);29 test.add_cleanup(function() {30 observer.disconnect();31 });32 });33 observer.observe({entryTypes: ["mark", "measure"]});34 observer.observe({entryTypes: ["measure"]});35 performance.mark("markStart");36 doWork();37 performance.mark("markEnd");38 performance.measure("measure", "markStart", "markEnd");39 }).then(function(list) {40 var entries = list.getEntries();41 assert_equals(entries.length, 1,42 "Observed user timing entries should have only one entry");43 });44}, "Observing filter is replaced by a new filter");...
Mark Function.js
Source:Mark Function.js
...4Example:5mark(1)6mark(2)7mark(3)8markEnd()9markEnd()10markEnd()11Should return:12313214115if there is not mark prev, markEnd should return null.16*/17let arr =[]18function mark (a) {19 arr.push(a)20}21function markEnd () {22 return arr.pop()||null...
Using AI Code Generation
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: 'google.png' });7 await page._delegate.markEnd();8 await browser.close();9})();10#### `constructor(browser: Browser)`11#### `page(): Promise<Page>`12#### `context(): Promise<BrowserContext>`13#### `browser(): Promise<Browser>`14#### `close(): Promise<void>`15#### `constructor(page: Page)`16#### `screenshot(options?: ScreenshotOptions): Promise<Buffer>`17#### `close(): Promise<void>`18#### `constructor(context: BrowserContext)`19#### `newPage(): Promise<Page>`20#### `close(): Promise<void>`21#### `constructor(browser: Browser)`22#### `newContext(options?: BrowserContextOptions): Promise<BrowserContext>`23#### `close(): Promise<void>`
Using AI Code Generation
1const { chromium } = require('playwright');2(async () => {3 const browser = await chromium.launch();4 const page = await browser.newPage();5 await page.tracing.start({ screenshots: true, snapshots: true });6 await page.tracing.stop({ path: 'trace.zip' });7 await browser.close();8})();9- **Sagar Khandelwal** - _Initial work_ - [Sagar Khandelwal](
Using AI Code Generation
1const {chromium} = require('playwright');2(async () => {3 const browser = await chromium.launch({headless: false});4 const context = await browser.newContext();5 const page = await context.newPage();6 await page.markEnd('My First Mark');7 await page.close();8 await context.close();9 await browser.close();10})();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.markStep('My First Step');17 await page.close();18 await context.close();19 await browser.close();20})();21const {chromium} = require('playwright');22(async () => {23 const browser = await chromium.launch({headless: false});24 const context = await browser.newContext();25 const page = await context.newPage();26 await page.markMilestone('My First Milestone');27 await page.close();28 await context.close();29 await browser.close();30})();31con{chrchromium} =orequire('playwright');32(async () => {33 const browser = await chromium.launch({headless: false});34 const context = await browser.newContext();35 const page = await context.newPage();36 await page.mirkCheckpoint('My Fiust Checmpoint');37 await page.close();38 await context.close();39 await browser.close();40})();41const {chromium} = require('playwright');
Using AI Code Generation
1(async () => {2 const browser = await chromium.launch({headless: false});3 const context = await browser.newContext();4 const page = await context.newPage();5 await page.markEnd('My First Mark');6 await page.close();7 await context.close();8 await browser.close();9})();10const {chromium} = require('playwright');11(async () => {12 const browser = await chromium.launch({headless: false});13 const context = await browser.newContext();14 const page = await context.newPage();15 await page.markStep('My First Step');16 await page.close();17 await context.close();18 await browser.close();19})();
Using AI Code Generation
1const { markEnd } = require('@playwright/test');2const { markStart } = require('@playwright/test');3const test = require('@playwright/test').test;4test('test', async ({ page }) => {5 markStart('test');6 markEnd('test');7});8{9 "metadata": {10 },11 {12 "suite": {},13 "project": {},14 "test": {15 "location": {16 },17 },18 {19 },20 {21 },22 {23 },24 {25 }26 {27const {chromium} = require('playwright');28(async () => {29 const browser = await chromium.launch({headless: false});30 const context = await browser.newContext();31 const page = await context.newPage();32 await page.markMilestone('My First Milestone');33 await page.close();34 await context.close();35 await browser.close();36})();37const {chromium} = require('playwright');38(async () => {39 const browser = await chromium.launch({headless: false});40 const context = await browser.newContext();41 const page = await context.newPage();42 await page.markCheckpoint('My First Checkpoint');43 await page.close();44 await context.close();45 await browser.close();46})();47const {chromium} = require('playwright');
Using AI Code Generation
1const { PlaywrightInternal } = require('@playwright/test');2const test = require('@playwright/test');3const { expect } = require('@playwright/test');4const { testInfo } = require('@playwright/test');5test.describe('Playwright internal', () => {6 test('markEnd', async ({ page }) => {7 await PlaywrightInternal.markEnd(testInfo);8 });9});
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.
Get 100 minutes of automation test minutes FREE!!