How to use checkIdentityKeys method in Playwright Internal

Best JavaScript code snippet using playwright-internal

reactivity.global.js

Source:reactivity.global.js Github

copy

Full Screen

...422 key = toRaw(key);423 hadKey = has.call(target, key);424 }425 else {426 checkIdentityKeys(target, has, key);427 }428 const oldValue = get.call(target, key);429 const result = set.call(target, key, value);430 if (!hadKey) {431 trigger(target, "add" /* ADD */, key, value);432 }433 else if (hasChanged(value, oldValue)) {434 trigger(target, "set" /* SET */, key, value, oldValue);435 }436 return result;437 }438 function deleteEntry(key) {439 const target = toRaw(this);440 const { has, get, delete: del } = getProto(target);441 let hadKey = has.call(target, key);442 if (!hadKey) {443 key = toRaw(key);444 hadKey = has.call(target, key);445 }446 else {447 checkIdentityKeys(target, has, key);448 }449 const oldValue = get ? get.call(target, key) : undefined;450 // forward the operation before queueing reactions451 const result = del.call(target, key);452 if (hadKey) {453 trigger(target, "delete" /* DELETE */, key, undefined, oldValue);454 }455 return result;456 }457 function clear() {458 const target = toRaw(this);459 const hadItems = target.size !== 0;460 const oldTarget = target instanceof Map461 ? new Map(target)462 : new Set(target)463 ;464 // forward the operation before queueing reactions465 const result = getProto(target).clear.call(target);466 if (hadItems) {467 trigger(target, "clear" /* CLEAR */, undefined, undefined, oldTarget);468 }469 return result;470 }471 function createForEach(isReadonly) {472 return function forEach(callback, thisArg) {473 const observed = this;474 const target = toRaw(observed);475 const wrap = isReadonly ? toReadonly : toReactive;476 track(target, "iterate" /* ITERATE */, ITERATE_KEY);477 // important: create sure the callback is478 // 1. invoked with the reactive map as `this` and 3rd arg479 // 2. the value received should be a corresponding reactive/readonly.480 function wrappedCallback(value, key) {481 return callback.call(observed, wrap(value), wrap(key), observed);482 }483 return getProto(target).forEach.call(target, wrappedCallback, thisArg);484 };485 }486 function createIterableMethod(method, isReadonly) {487 return function (...args) {488 const target = toRaw(this);489 const isMap = target instanceof Map;490 const isPair = method === 'entries' || (method === Symbol.iterator && isMap);491 const isKeyOnly = method === 'keys' && isMap;492 const innerIterator = getProto(target)[method].apply(target, args);493 const wrap = isReadonly ? toReadonly : toReactive;494 track(target, "iterate" /* ITERATE */, isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY);495 // return a wrapped iterator which returns observed versions of the496 // values emitted from the real iterator497 return {498 // iterator protocol499 next() {500 const { value, done } = innerIterator.next();501 return done502 ? { value, done }503 : {504 value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),505 done506 };507 },508 // iterable protocol509 [Symbol.iterator]() {510 return this;511 }512 };513 };514 }515 function createReadonlyMethod(method, type) {516 return function (...args) {517 if (LOCKED) {518 {519 const key = args[0] ? `on key "${args[0]}" ` : ``;520 console.warn(`${capitalize(type)} operation ${key}failed: target is readonly.`, toRaw(this));521 }522 return type === "delete" /* DELETE */ ? false : this;523 }524 else {525 return method.apply(this, args);526 }527 };528 }529 const mutableInstrumentations = {530 get(key) {531 return get$1(this, key, toReactive);532 },533 get size() {534 return size(this);535 },536 has: has$1,537 add,538 set: set$1,539 delete: deleteEntry,540 clear,541 forEach: createForEach(false)542 };543 const readonlyInstrumentations = {544 get(key) {545 return get$1(this, key, toReadonly);546 },547 get size() {548 return size(this);549 },550 has: has$1,551 add: createReadonlyMethod(add, "add" /* ADD */),552 set: createReadonlyMethod(set$1, "set" /* SET */),553 delete: createReadonlyMethod(deleteEntry, "delete" /* DELETE */),554 clear: createReadonlyMethod(clear, "clear" /* CLEAR */),555 forEach: createForEach(true)556 };557 const iteratorMethods = ['keys', 'values', 'entries', Symbol.iterator];558 iteratorMethods.forEach(method => {559 mutableInstrumentations[method] = createIterableMethod(method, false);560 readonlyInstrumentations[method] = createIterableMethod(method, true);561 });562 function createInstrumentationGetter(instrumentations) {563 return (target, key, receiver) => Reflect.get(hasOwn(instrumentations, key) && key in target564 ? instrumentations565 : target, key, receiver);566 }567 const mutableCollectionHandlers = {568 get: createInstrumentationGetter(mutableInstrumentations)569 };570 const readonlyCollectionHandlers = {571 get: createInstrumentationGetter(readonlyInstrumentations)572 };573 function checkIdentityKeys(target, has, key) {574 const rawKey = toRaw(key);575 if (rawKey !== key && has.call(target, rawKey)) {576 const type = toRawType(target);577 console.warn(`Reactive ${type} contains both the raw and reactive ` +578 `versions of the same object${type === `Map` ? `as keys` : ``}, ` +579 `which can lead to inconsistencies. ` +580 `Avoid differentiating between the raw and reactive versions ` +581 `of an object and only use the reactive version if possible.`);582 }583 }584 // WeakMaps that store {raw <-> observed} pairs.585 const rawToReactive = new WeakMap();586 const reactiveToRaw = new WeakMap();587 const rawToReadonly = new WeakMap();...

Full Screen

Full Screen

reactivity.cjs.js

Source:reactivity.cjs.js Github

copy

Full Screen

...377 key = toRaw(key);378 hadKey = has.call(target, key);379 }380 else {381 checkIdentityKeys(target, has, key);382 }383 const oldValue = get.call(target, key);384 const result = set.call(target, key, value);385 if (!hadKey) {386 trigger(target, "add" /* ADD */, key, value);387 }388 else if (shared.hasChanged(value, oldValue)) {389 trigger(target, "set" /* SET */, key, value, oldValue);390 }391 return result;392}393function deleteEntry(key) {394 const target = toRaw(this);395 const { has, get, delete: del } = getProto(target);396 let hadKey = has.call(target, key);397 if (!hadKey) {398 key = toRaw(key);399 hadKey = has.call(target, key);400 }401 else {402 checkIdentityKeys(target, has, key);403 }404 const oldValue = get ? get.call(target, key) : undefined;405 // forward the operation before queueing reactions406 const result = del.call(target, key);407 if (hadKey) {408 trigger(target, "delete" /* DELETE */, key, undefined, oldValue);409 }410 return result;411}412function clear() {413 const target = toRaw(this);414 const hadItems = target.size !== 0;415 const oldTarget = target instanceof Map416 ? new Map(target)417 : new Set(target)418 ;419 // forward the operation before queueing reactions420 const result = getProto(target).clear.call(target);421 if (hadItems) {422 trigger(target, "clear" /* CLEAR */, undefined, undefined, oldTarget);423 }424 return result;425}426function createForEach(isReadonly, isShallow) {427 return function forEach(callback, thisArg) {428 const observed = this;429 const target = toRaw(observed);430 const wrap = isReadonly ? toReadonly : isShallow ? toShallow : toReactive;431 !isReadonly && track(target, "iterate" /* ITERATE */, ITERATE_KEY);432 // important: create sure the callback is433 // 1. invoked with the reactive map as `this` and 3rd arg434 // 2. the value received should be a corresponding reactive/readonly.435 function wrappedCallback(value, key) {436 return callback.call(thisArg, wrap(value), wrap(key), observed);437 }438 return getProto(target).forEach.call(target, wrappedCallback);439 };440}441function createIterableMethod(method, isReadonly, isShallow) {442 return function (...args) {443 const target = this["__v_raw" /* RAW */];444 const rawTarget = toRaw(target);445 const isMap = rawTarget instanceof Map;446 const isPair = method === 'entries' || (method === Symbol.iterator && isMap);447 const isKeyOnly = method === 'keys' && isMap;448 const innerIterator = target[method](...args);449 const wrap = isReadonly ? toReadonly : isShallow ? toShallow : toReactive;450 !isReadonly &&451 track(rawTarget, "iterate" /* ITERATE */, isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY);452 // return a wrapped iterator which returns observed versions of the453 // values emitted from the real iterator454 return {455 // iterator protocol456 next() {457 const { value, done } = innerIterator.next();458 return done459 ? { value, done }460 : {461 value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),462 done463 };464 },465 // iterable protocol466 [Symbol.iterator]() {467 return this;468 }469 };470 };471}472function createReadonlyMethod(type) {473 return function (...args) {474 {475 const key = args[0] ? `on key "${args[0]}" ` : ``;476 console.warn(`${shared.capitalize(type)} operation ${key}failed: target is readonly.`, toRaw(this));477 }478 return type === "delete" /* DELETE */ ? false : this;479 };480}481const mutableInstrumentations = {482 get(key) {483 return get$1(this, key);484 },485 get size() {486 return size(this);487 },488 has: has$1,489 add,490 set: set$1,491 delete: deleteEntry,492 clear,493 forEach: createForEach(false, false)494};495const shallowInstrumentations = {496 get(key) {497 return get$1(this, key, false, true);498 },499 get size() {500 return size(this);501 },502 has: has$1,503 add,504 set: set$1,505 delete: deleteEntry,506 clear,507 forEach: createForEach(false, true)508};509const readonlyInstrumentations = {510 get(key) {511 return get$1(this, key, true);512 },513 get size() {514 return size(this, true);515 },516 has(key) {517 return has$1.call(this, key, true);518 },519 add: createReadonlyMethod("add" /* ADD */),520 set: createReadonlyMethod("set" /* SET */),521 delete: createReadonlyMethod("delete" /* DELETE */),522 clear: createReadonlyMethod("clear" /* CLEAR */),523 forEach: createForEach(true, false)524};525const iteratorMethods = ['keys', 'values', 'entries', Symbol.iterator];526iteratorMethods.forEach(method => {527 mutableInstrumentations[method] = createIterableMethod(method, false, false);528 readonlyInstrumentations[method] = createIterableMethod(method, true, false);529 shallowInstrumentations[method] = createIterableMethod(method, false, true);530});531function createInstrumentationGetter(isReadonly, shallow) {532 const instrumentations = shallow533 ? shallowInstrumentations534 : isReadonly535 ? readonlyInstrumentations536 : mutableInstrumentations;537 return (target, key, receiver) => {538 if (key === "__v_isReactive" /* IS_REACTIVE */) {539 return !isReadonly;540 }541 else if (key === "__v_isReadonly" /* IS_READONLY */) {542 return isReadonly;543 }544 else if (key === "__v_raw" /* RAW */) {545 return target;546 }547 return Reflect.get(shared.hasOwn(instrumentations, key) && key in target548 ? instrumentations549 : target, key, receiver);550 };551}552const mutableCollectionHandlers = {553 get: createInstrumentationGetter(false, false)554};555const shallowCollectionHandlers = {556 get: createInstrumentationGetter(false, true)557};558const readonlyCollectionHandlers = {559 get: createInstrumentationGetter(true, false)560};561function checkIdentityKeys(target, has, key) {562 const rawKey = toRaw(key);563 if (rawKey !== key && has.call(target, rawKey)) {564 const type = shared.toRawType(target);565 console.warn(`Reactive ${type} contains both the raw and reactive ` +566 `versions of the same object${type === `Map` ? `as keys` : ``}, ` +567 `which can lead to inconsistencies. ` +568 `Avoid differentiating between the raw and reactive versions ` +569 `of an object and only use the reactive version if possible.`);570 }571}572const collectionTypes = new Set([Set, Map, WeakMap, WeakSet]);573const isObservableType = /*#__PURE__*/ shared.makeMap('Object,Array,Map,Set,WeakMap,WeakSet');574const canObserve = (value) => {575 return (!value["__v_skip" /* SKIP */] && ...

Full Screen

Full Screen

reactivity.esm-bundler.js

Source:reactivity.esm-bundler.js Github

copy

Full Screen

...375 key = toRaw(key);376 hadKey = has.call(target, key);377 }378 else if ((process.env.NODE_ENV !== 'production')) {379 checkIdentityKeys(target, has, key);380 }381 const oldValue = get.call(target, key);382 const result = set.call(target, key, value);383 if (!hadKey) {384 trigger(target, "add" /* ADD */, key, value);385 }386 else if (hasChanged(value, oldValue)) {387 trigger(target, "set" /* SET */, key, value, oldValue);388 }389 return result;390}391function deleteEntry(key) {392 const target = toRaw(this);393 const { has, get, delete: del } = getProto(target);394 let hadKey = has.call(target, key);395 if (!hadKey) {396 key = toRaw(key);397 hadKey = has.call(target, key);398 }399 else if ((process.env.NODE_ENV !== 'production')) {400 checkIdentityKeys(target, has, key);401 }402 const oldValue = get ? get.call(target, key) : undefined;403 // forward the operation before queueing reactions404 const result = del.call(target, key);405 if (hadKey) {406 trigger(target, "delete" /* DELETE */, key, undefined, oldValue);407 }408 return result;409}410function clear() {411 const target = toRaw(this);412 const hadItems = target.size !== 0;413 const oldTarget = (process.env.NODE_ENV !== 'production')414 ? target instanceof Map415 ? new Map(target)416 : new Set(target)417 : undefined;418 // forward the operation before queueing reactions419 const result = getProto(target).clear.call(target);420 if (hadItems) {421 trigger(target, "clear" /* CLEAR */, undefined, undefined, oldTarget);422 }423 return result;424}425function createForEach(isReadonly, isShallow) {426 return function forEach(callback, thisArg) {427 const observed = this;428 const target = toRaw(observed);429 const wrap = isReadonly ? toReadonly : isShallow ? toShallow : toReactive;430 !isReadonly && track(target, "iterate" /* ITERATE */, ITERATE_KEY);431 // important: create sure the callback is432 // 1. invoked with the reactive map as `this` and 3rd arg433 // 2. the value received should be a corresponding reactive/readonly.434 function wrappedCallback(value, key) {435 return callback.call(thisArg, wrap(value), wrap(key), observed);436 }437 return getProto(target).forEach.call(target, wrappedCallback);438 };439}440function createIterableMethod(method, isReadonly, isShallow) {441 return function (...args) {442 const target = this["__v_raw" /* RAW */];443 const rawTarget = toRaw(target);444 const isMap = rawTarget instanceof Map;445 const isPair = method === 'entries' || (method === Symbol.iterator && isMap);446 const isKeyOnly = method === 'keys' && isMap;447 const innerIterator = target[method](...args);448 const wrap = isReadonly ? toReadonly : isShallow ? toShallow : toReactive;449 !isReadonly &&450 track(rawTarget, "iterate" /* ITERATE */, isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY);451 // return a wrapped iterator which returns observed versions of the452 // values emitted from the real iterator453 return {454 // iterator protocol455 next() {456 const { value, done } = innerIterator.next();457 return done458 ? { value, done }459 : {460 value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),461 done462 };463 },464 // iterable protocol465 [Symbol.iterator]() {466 return this;467 }468 };469 };470}471function createReadonlyMethod(type) {472 return function (...args) {473 if ((process.env.NODE_ENV !== 'production')) {474 const key = args[0] ? `on key "${args[0]}" ` : ``;475 console.warn(`${capitalize(type)} operation ${key}failed: target is readonly.`, toRaw(this));476 }477 return type === "delete" /* DELETE */ ? false : this;478 };479}480const mutableInstrumentations = {481 get(key) {482 return get$1(this, key);483 },484 get size() {485 return size(this);486 },487 has: has$1,488 add,489 set: set$1,490 delete: deleteEntry,491 clear,492 forEach: createForEach(false, false)493};494const shallowInstrumentations = {495 get(key) {496 return get$1(this, key, false, true);497 },498 get size() {499 return size(this);500 },501 has: has$1,502 add,503 set: set$1,504 delete: deleteEntry,505 clear,506 forEach: createForEach(false, true)507};508const readonlyInstrumentations = {509 get(key) {510 return get$1(this, key, true);511 },512 get size() {513 return size(this, true);514 },515 has(key) {516 return has$1.call(this, key, true);517 },518 add: createReadonlyMethod("add" /* ADD */),519 set: createReadonlyMethod("set" /* SET */),520 delete: createReadonlyMethod("delete" /* DELETE */),521 clear: createReadonlyMethod("clear" /* CLEAR */),522 forEach: createForEach(true, false)523};524const iteratorMethods = ['keys', 'values', 'entries', Symbol.iterator];525iteratorMethods.forEach(method => {526 mutableInstrumentations[method] = createIterableMethod(method, false, false);527 readonlyInstrumentations[method] = createIterableMethod(method, true, false);528 shallowInstrumentations[method] = createIterableMethod(method, false, true);529});530function createInstrumentationGetter(isReadonly, shallow) {531 const instrumentations = shallow532 ? shallowInstrumentations533 : isReadonly534 ? readonlyInstrumentations535 : mutableInstrumentations;536 return (target, key, receiver) => {537 if (key === "__v_isReactive" /* IS_REACTIVE */) {538 return !isReadonly;539 }540 else if (key === "__v_isReadonly" /* IS_READONLY */) {541 return isReadonly;542 }543 else if (key === "__v_raw" /* RAW */) {544 return target;545 }546 return Reflect.get(hasOwn(instrumentations, key) && key in target547 ? instrumentations548 : target, key, receiver);549 };550}551const mutableCollectionHandlers = {552 get: createInstrumentationGetter(false, false)553};554const shallowCollectionHandlers = {555 get: createInstrumentationGetter(false, true)556};557const readonlyCollectionHandlers = {558 get: createInstrumentationGetter(true, false)559};560function checkIdentityKeys(target, has, key) {561 const rawKey = toRaw(key);562 if (rawKey !== key && has.call(target, rawKey)) {563 const type = toRawType(target);564 console.warn(`Reactive ${type} contains both the raw and reactive ` +565 `versions of the same object${type === `Map` ? `as keys` : ``}, ` +566 `which can lead to inconsistencies. ` +567 `Avoid differentiating between the raw and reactive versions ` +568 `of an object and only use the reactive version if possible.`);569 }570}571const collectionTypes = new Set([Set, Map, WeakMap, WeakSet]);572const isObservableType = /*#__PURE__*/ makeMap('Object,Array,Map,Set,WeakMap,WeakSet');573const canObserve = (value) => {574 return (!value["__v_skip" /* SKIP */] && ...

Full Screen

Full Screen

reactivity.esm-browser.js

Source:reactivity.esm-browser.js Github

copy

Full Screen

...425 key = toRaw(key);426 hadKey = has.call(target, key);427 }428 else {429 checkIdentityKeys(target, has, key);430 }431 const oldValue = get.call(target, key);432 const result = set.call(target, key, value);433 if (!hadKey) {434 trigger(target, "add" /* ADD */, key, value);435 }436 else if (hasChanged(value, oldValue)) {437 trigger(target, "set" /* SET */, key, value, oldValue);438 }439 return result;440}441function deleteEntry(key) {442 const target = toRaw(this);443 const { has, get, delete: del } = getProto(target);444 let hadKey = has.call(target, key);445 if (!hadKey) {446 key = toRaw(key);447 hadKey = has.call(target, key);448 }449 else {450 checkIdentityKeys(target, has, key);451 }452 const oldValue = get ? get.call(target, key) : undefined;453 // forward the operation before queueing reactions454 const result = del.call(target, key);455 if (hadKey) {456 trigger(target, "delete" /* DELETE */, key, undefined, oldValue);457 }458 return result;459}460function clear() {461 const target = toRaw(this);462 const hadItems = target.size !== 0;463 const oldTarget = target instanceof Map464 ? new Map(target)465 : new Set(target)466 ;467 // forward the operation before queueing reactions468 const result = getProto(target).clear.call(target);469 if (hadItems) {470 trigger(target, "clear" /* CLEAR */, undefined, undefined, oldTarget);471 }472 return result;473}474function createForEach(isReadonly, shallow) {475 return function forEach(callback, thisArg) {476 const observed = this;477 const target = toRaw(observed);478 const wrap = isReadonly ? toReadonly : shallow ? toShallow : toReactive;479 !isReadonly && track(target, "iterate" /* ITERATE */, ITERATE_KEY);480 // important: create sure the callback is481 // 1. invoked with the reactive map as `this` and 3rd arg482 // 2. the value received should be a corresponding reactive/readonly.483 function wrappedCallback(value, key) {484 return callback.call(thisArg, wrap(value), wrap(key), observed);485 }486 return getProto(target).forEach.call(target, wrappedCallback);487 };488}489function createIterableMethod(method, isReadonly, shallow) {490 return function (...args) {491 const target = toRaw(this);492 const isMap = target instanceof Map;493 const isPair = method === 'entries' || (method === Symbol.iterator && isMap);494 const isKeyOnly = method === 'keys' && isMap;495 const innerIterator = getProto(target)[method].apply(target, args);496 const wrap = isReadonly ? toReadonly : shallow ? toShallow : toReactive;497 !isReadonly &&498 track(target, "iterate" /* ITERATE */, isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY);499 // return a wrapped iterator which returns observed versions of the500 // values emitted from the real iterator501 return {502 // iterator protocol503 next() {504 const { value, done } = innerIterator.next();505 return done506 ? { value, done }507 : {508 value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),509 done510 };511 },512 // iterable protocol513 [Symbol.iterator]() {514 return this;515 }516 };517 };518}519function createReadonlyMethod(type) {520 return function (...args) {521 {522 const key = args[0] ? `on key "${args[0]}" ` : ``;523 console.warn(`${capitalize(type)} operation ${key}failed: target is readonly.`, toRaw(this));524 }525 return type === "delete" /* DELETE */ ? false : this;526 };527}528const mutableInstrumentations = {529 get(key) {530 return get$1(this, key, toReactive);531 },532 get size() {533 return size(this);534 },535 has: has$1,536 add,537 set: set$1,538 delete: deleteEntry,539 clear,540 forEach: createForEach(false, false)541};542const shallowInstrumentations = {543 get(key) {544 return get$1(this, key, toShallow);545 },546 get size() {547 return size(this);548 },549 has: has$1,550 add,551 set: set$1,552 delete: deleteEntry,553 clear,554 forEach: createForEach(false, true)555};556const readonlyInstrumentations = {557 get(key) {558 return get$1(this, key, toReadonly);559 },560 get size() {561 return size(this);562 },563 has: has$1,564 add: createReadonlyMethod("add" /* ADD */),565 set: createReadonlyMethod("set" /* SET */),566 delete: createReadonlyMethod("delete" /* DELETE */),567 clear: createReadonlyMethod("clear" /* CLEAR */),568 forEach: createForEach(true, false)569};570const iteratorMethods = ['keys', 'values', 'entries', Symbol.iterator];571iteratorMethods.forEach(method => {572 mutableInstrumentations[method] = createIterableMethod(method, false, false);573 readonlyInstrumentations[method] = createIterableMethod(method, true, false);574 shallowInstrumentations[method] = createIterableMethod(method, false, true);575});576function createInstrumentationGetter(isReadonly, shallow) {577 const instrumentations = shallow578 ? shallowInstrumentations579 : isReadonly580 ? readonlyInstrumentations581 : mutableInstrumentations;582 return (target, key, receiver) => {583 if (key === "__v_isReactive" /* IS_REACTIVE */) {584 return !isReadonly;585 }586 else if (key === "__v_isReadonly" /* IS_READONLY */) {587 return isReadonly;588 }589 else if (key === "__v_raw" /* RAW */) {590 return target;591 }592 return Reflect.get(hasOwn(instrumentations, key) && key in target593 ? instrumentations594 : target, key, receiver);595 };596}597const mutableCollectionHandlers = {598 get: createInstrumentationGetter(false, false)599};600const shallowCollectionHandlers = {601 get: createInstrumentationGetter(false, true)602};603const readonlyCollectionHandlers = {604 get: createInstrumentationGetter(true, false)605};606function checkIdentityKeys(target, has, key) {607 const rawKey = toRaw(key);608 if (rawKey !== key && has.call(target, rawKey)) {609 const type = toRawType(target);610 console.warn(`Reactive ${type} contains both the raw and reactive ` +611 `versions of the same object${type === `Map` ? `as keys` : ``}, ` +612 `which can lead to inconsistencies. ` +613 `Avoid differentiating between the raw and reactive versions ` +614 `of an object and only use the reactive version if possible.`);615 }616}617const collectionTypes = new Set([Set, Map, WeakMap, WeakSet]);618const isObservableType = /*#__PURE__*/ makeMap('Object,Array,Map,Set,WeakMap,WeakSet');619const canObserve = (value) => {620 return (!value["__v_skip" /* SKIP */] &&...

Full Screen

Full Screen

vuerx.cjs

Source:vuerx.cjs Github

copy

Full Screen

...428 key = toRaw(key);429 hadKey = has.call(target, key);430 }431 else {432 checkIdentityKeys(target, has, key);433 }434 const oldValue = get.call(target, key);435 const result = set.call(target, key, value);436 if (!hadKey) {437 trigger(target, "add" /* ADD */, key, value);438 }439 else if (hasChanged(value, oldValue)) {440 trigger(target, "set" /* SET */, key, value, oldValue);441 }442 return result;443}444function deleteEntry(key) {445 const target = toRaw(this);446 const { has, get, delete: del } = getProto(target);447 let hadKey = has.call(target, key);448 if (!hadKey) {449 key = toRaw(key);450 hadKey = has.call(target, key);451 }452 else {453 checkIdentityKeys(target, has, key);454 }455 const oldValue = get ? get.call(target, key) : undefined;456 // forward the operation before queueing reactions457 const result = del.call(target, key);458 if (hadKey) {459 trigger(target, "delete" /* DELETE */, key, undefined, oldValue);460 }461 return result;462}463function clear() {464 const target = toRaw(this);465 const hadItems = target.size !== 0;466 const oldTarget = target instanceof Map467 ? new Map(target)468 : new Set(target)469 ;470 // forward the operation before queueing reactions471 const result = getProto(target).clear.call(target);472 if (hadItems) {473 trigger(target, "clear" /* CLEAR */, undefined, undefined, oldTarget);474 }475 return result;476}477function createForEach(isReadonly) {478 return function forEach(callback, thisArg) {479 const observed = this;480 const target = toRaw(observed);481 const wrap = isReadonly ? toReadonly : toReactive;482 !isReadonly && track(target, "iterate" /* ITERATE */, ITERATE_KEY);483 // important: create sure the callback is484 // 1. invoked with the reactive map as `this` and 3rd arg485 // 2. the value received should be a corresponding reactive/readonly.486 function wrappedCallback(value, key) {487 return callback.call(thisArg, wrap(value), wrap(key), observed);488 }489 return getProto(target).forEach.call(target, wrappedCallback);490 };491}492function createIterableMethod(method, isReadonly) {493 return function (...args) {494 const target = toRaw(this);495 const isMap = target instanceof Map;496 const isPair = method === 'entries' || (method === Symbol.iterator && isMap);497 const isKeyOnly = method === 'keys' && isMap;498 const innerIterator = getProto(target)[method].apply(target, args);499 const wrap = isReadonly ? toReadonly : toReactive;500 !isReadonly &&501 track(target, "iterate" /* ITERATE */, isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY);502 // return a wrapped iterator which returns observed versions of the503 // values emitted from the real iterator504 return {505 // iterator protocol506 next() {507 const { value, done } = innerIterator.next();508 return done509 ? { value, done }510 : {511 value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),512 done513 };514 },515 // iterable protocol516 [Symbol.iterator]() {517 return this;518 }519 };520 };521}522function createReadonlyMethod(type) {523 return function (...args) {524 {525 const key = args[0] ? `on key "${args[0]}" ` : ``;526 console.warn(`${capitalize(type)} operation ${key}failed: target is readonly.`, toRaw(this));527 }528 return type === "delete" /* DELETE */ ? false : this;529 };530}531const mutableInstrumentations = {532 get(key) {533 return get$1(this, key, toReactive);534 },535 get size() {536 return size(this);537 },538 has: has$1,539 add,540 set: set$1,541 delete: deleteEntry,542 clear,543 forEach: createForEach(false)544};545const readonlyInstrumentations = {546 get(key) {547 return get$1(this, key, toReadonly);548 },549 get size() {550 return size(this);551 },552 has: has$1,553 add: createReadonlyMethod("add" /* ADD */),554 set: createReadonlyMethod("set" /* SET */),555 delete: createReadonlyMethod("delete" /* DELETE */),556 clear: createReadonlyMethod("clear" /* CLEAR */),557 forEach: createForEach(true)558};559const iteratorMethods = ['keys', 'values', 'entries', Symbol.iterator];560iteratorMethods.forEach(method => {561 mutableInstrumentations[method] = createIterableMethod(method, false);562 readonlyInstrumentations[method] = createIterableMethod(method, true);563});564function createInstrumentationGetter(isReadonly) {565 const instrumentations = isReadonly566 ? readonlyInstrumentations567 : mutableInstrumentations;568 return (target, key, receiver) => {569 if (key === "__v_isReactive" /* isReactive */) {570 return !isReadonly;571 }572 else if (key === "__v_isReadonly" /* isReadonly */) {573 return isReadonly;574 }575 else if (key === "__v_raw" /* raw */) {576 return target;577 }578 return Reflect.get(hasOwn(instrumentations, key) && key in target579 ? instrumentations580 : target, key, receiver);581 };582}583const mutableCollectionHandlers = {584 get: createInstrumentationGetter(false)585};586const readonlyCollectionHandlers = {587 get: createInstrumentationGetter(true)588};589function checkIdentityKeys(target, has, key) {590 const rawKey = toRaw(key);591 if (rawKey !== key && has.call(target, rawKey)) {592 const type = toRawType(target);593 console.warn(`Reactive ${type} contains both the raw and reactive ` +594 `versions of the same object${type === `Map` ? `as keys` : ``}, ` +595 `which can lead to inconsistencies. ` +596 `Avoid differentiating between the raw and reactive versions ` +597 `of an object and only use the reactive version if possible.`);598 }599}600601const collectionTypes = new Set([Set, Map, WeakMap, WeakSet]);602const isObservableType = /*#__PURE__*/ makeMap('Object,Array,Map,Set,WeakMap,WeakSet');603const canObserve = (value) => { ...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const { checkIdentityKeys } = require('playwright');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 const identityKey = await checkIdentityKeys(page);8 console.log(identityKey);9 await browser.close();10})();11 at CDPSession.send (D:\projects\playwright\playwright\lib\cdp.js:61:27)12 at CDPSession.send (D:\projects\playwright\playwright\lib\cdp.js:37:26)13 at CDPSession.send (D:\projects\playwright\playwright\lib\cdp.js:37:26)14 at CDPSession.send (D:\projects\playwright\playwright\lib\cdp.js:37:26)15 at CDPSession.send (D:\projects\playwright\playwright\lib\cdp.js:37:26)16 at CDPSession.send (D:\projects\playwright\playwright\lib\cdp.js:37:26)17 at CDPSession.send (D:\projects\playwright\playwright\lib\cdp.js:37:26)18 at CDPSession.send (D:\projects\playwright\playwright\lib\cdp.js:37:26)19 at CDPSession.send (D:\projects\playwright\playwright\lib\cdp.js:37:26)20 at CDPSession.send (D:\projects\playwright\playwright\lib\cdp.js:37:26)

Full Screen

Using AI Code Generation

copy

Full Screen

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

Full Screen

Using AI Code Generation

copy

Full Screen

1const playwright = require('playwright');2(async () => {3 const browser = await playwright.chromium.launch();4 const context = await browser.newContext();5 const page = await context.newPage();6 const [request] = await Promise.all([7 page.waitForRequest('**/api/identity'),8 ]);9 const response = request.response();10 const { identity } = await response.json();11 console.log(await page.context().checkIdentityKeys(identity));12 await browser.close();13})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const {checkIdentityKeys} = require('playwright/lib/server/browserContext');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 page.screenshot({ path: 'google.png' });8 const key = await page.evaluate(() => {9 const {key} = window.crypto;10 return key;11 });12 const key2 = await page.evaluate(() => {13 const {key} = window.crypto;14 return key;15 });16 console.log(await checkIdentityKeys(key, key2));17 await browser.close();18})();19const {checkIdentityKeys} = require('playwright/lib/server/browserContext');20const {chromium} = require('playwright');21(async () => {22 const browser = await chromium.launch();23 const context = await browser.newContext();24 const page = await context.newPage();25 await page.screenshot({ path: 'google.png' });26 const key = await page.evaluate(() => {27 const {key} = window.crypto;28 return key;29 });30 const key2 = await page.evaluate(() => {31 const {key} = window.crypto;32 return key;33 });34 console.log(await checkIdentityKeys(key, key2));35 await browser.close();36})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chromium } = require('playwright');2const { checkIdentityKeys } = require('playwright/lib/server/browserType');3const assert = require('assert');4(async () => {5 const browser = await chromium.launch();6 const context = await browser.newContext();7 const page = await context.newPage();8 const key1 = await checkIdentityKeys(page);9 const key2 = await checkIdentityKeys(page);10 assert.strictEqual(key1, key2);11 await browser.close();12})();13 at Object.<anonymous> (/Users/username/playwright-test/test.js:18:8)14 at Module._compile (internal/modules/cjs/loader.js:1072:14)15 at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)16 at Module.load (internal/modules/cjs/loader.js:937:32)17 at Function.Module._load (internal/modules/cjs/loader.js:778:12)18 at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)19 at internal/main/run_main_module.js:17:47 {20}

Full Screen

Using AI Code Generation

copy

Full Screen

1const {checkIdentityKeys} = require('playwright/lib/internal/keyboard');2const expectedKeys = ['KeyA', 'KeyB', 'KeyC'];3const actualKeys = ['KeyA', 'KeyB', 'KeyC'];4const result = checkIdentityKeys(expectedKeys, actualKeys);5console.log(result);6const { getKeyboardLayout } = require('playwright/lib/internal/keyboard');7const layout = getKeyboardLayout();8console.log(layout);9const { getKeyboardLayout } = require('playwright/lib/internal/keyboard');10const layout = getKeyboardLayout();11console.log(layout);12const { getKeyboardLayout } = require('playwright/lib/internal/keyboard');13const layout = getKeyboardLayout();14console.log(layout);

Full Screen

Using AI Code Generation

copy

Full Screen

1const { checkIdentityKeys } = require('playwright-core/lib/protocol/protocol.js');2(async () => {3const { checkIdentityKeys } = require('playwright-core/lib/protocol/protocol.js');4(async () => {5const { checkIdentityKeys } = require('playwright-core/lib/protocol/protocol.js');6(async () => {7const { checkIdentityKeys } = require('playwright-core/lib/protocol/protocol.js');8(async () => {9const { checkIdentityKeys } = require('playwright-core/lib/protocol/protocol.js');10(async () => {11const { checkIdentityKeys } = require('playwright-core/lib/protocol/protocol.js');12(async () => {13const { checkIdentityKeys } = require('playwright-core/lib/protocol/protocol.js');14(async () => {15const { checkIdentityKeys } = require('playwright-core/lib/protocol/protocol.js');16(async () => {17const { checkIdentityKeys } = require('playwright-core/lib/protocol/protocol.js');18(async () => {19const { checkIdentityKeys } = require('playwright-core/lib/protocol/protocol.js');20(async () => {21const { checkIdentityKeys } = require('playwright-core/lib/protocol/protocol.js');22(async () => {23const { checkIdentityKeys } = require('playwright-core/lib/protocol/protocol.js');24(async () => {25const { checkIdentityKeys } = require('playwright-core/lib/protocol/protocol.js');26(async () => {27const { checkIdentityKeys } = require('playwright-core/lib/protocol/

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