Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

assertions-recorder

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

assertions-recorder - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

4

dist/cjs/index.js

@@ -9,2 +9,4 @@ 'use strict';

var _optimalSelect2 = _interopRequireDefault(_optimalSelect);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -31,3 +33,3 @@

window.addEventListener(key.slice(2), function (event) {
parent.emit('child-dom-events', { type: event.type, path: (0, _optimalSelect.select)(event.target) });
parent.emit('child-dom-events', { type: event.type, path: (0, _optimalSelect2.default)(event.target) });
});

@@ -34,0 +36,0 @@ /*eslint-enable */

import Postmate from 'postmate';
import { select } from 'optimal-select';
import select from 'optimal-select';

@@ -4,0 +4,0 @@ function instrument(ajs, parent) {

(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('optimal-select')) :
typeof define === 'function' && define.amd ? define(['optimal-select'], factory) :
(factory(global.optimalSelect));
}(this, (function (optimalSelect) { 'use strict';
(factory(global.select));
}(this, (function (select) { 'use strict';
select = 'default' in select ? select['default'] : select;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

@@ -437,3 +439,3 @@

window.addEventListener(key.slice(2), function (event) {
parent.emit('child-dom-events', { type: event.type, path: optimalSelect.select(event.target) });
parent.emit('child-dom-events', { type: event.type, path: select(event.target) });
});

@@ -440,0 +442,0 @@ /*eslint-enable */

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("optimal-select")):"function"==typeof define&&define.amd?define(["optimal-select"],t):t(e.optimalSelect)}(this,function(n){"use strict";var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c="application/x-postmate-v1+json",d=Object.prototype.hasOwnProperty,a=0,l=function(e,t){return e.origin===t&&("object"===i(e.data)&&("postmate"in e.data&&(e.data.type===c&&!!{"handshake-reply":1,call:1,emit:1,reply:1,request:1}[e.data.postmate])))},p=function(){function e(e){var o=this;this.parent=e.parent,this.frame=e.frame,this.child=e.child,this.childOrigin=e.childOrigin,this.events={},this.listener=function(e){var t=((e||{}).data||{}).value||{},n=t.data,i=t.name;"emit"===e.data.postmate&&i in o.events&&o.events[i].call(o,n)},this.parent.addEventListener("message",this.listener,!1)}var t=e.prototype;return t.get=function(e){var o=this;return new m.Promise(function(n){var i=++a;o.parent.addEventListener("message",function e(t){t.data.uid===i&&"reply"===t.data.postmate&&(o.parent.removeEventListener("message",e,!1),n(t.data.value))},!1),o.child.postMessage({postmate:"request",type:c,property:e,uid:i},o.childOrigin)})},t.call=function(e,t){this.child.postMessage({postmate:"call",type:c,property:e,data:t},this.childOrigin)},t.on=function(e,t){this.events[e]=t},t.destroy=function(){window.removeEventListener("message",this.listener,!1),this.frame.parentNode.removeChild(this.frame)},e}(),h=function(){function e(e){var d=this;this.model=e.model,this.parent=e.parent,this.parentOrigin=e.parentOrigin,this.child=e.child,this.child.addEventListener("message",function(t){if(l(t,d.parentOrigin)){var e,n,i,o=t.data,a=o.property,r=o.uid,s=o.data;if("call"!==t.data.postmate)(e=d.model,n=a,i="function"==typeof e[n]?e[n]():e[n],m.Promise.resolve(i)).then(function(e){return t.source.postMessage({property:a,postmate:"reply",type:c,uid:r,value:e},t.origin)});else a in d.model&&"function"==typeof d.model[a]&&d.model[a].call(d,s)}})}return e.prototype.emit=function(e,t){this.parent.postMessage({postmate:"emit",type:c,value:{name:e,data:t}},this.parentOrigin)},e}(),m=function(){function e(e){var t=void 0===e?userOptions:e,n=t.container,i=void 0===n?void 0!==i?i:document.body:n,o=t.model,a=t.url;return this.parent=window,this.frame=document.createElement("iframe"),i.appendChild(this.frame),this.child=this.frame.contentWindow||this.frame.contentDocument.parentWindow,this.model=o||{},this.sendHandshake(a)}return e.prototype.sendHandshake=function(o){var a,r=this,s=function(e){var t=document.createElement("a");t.href=e;var n=4<t.protocol.length?t.protocol:window.location.protocol,i=t.host.length?"80"===t.port||"443"===t.port?t.hostname:t.host:window.location.host;return t.origin||n+"//"+i}(o),d=0;return new e.Promise(function(n,i){r.parent.addEventListener("message",function e(t){return!!l(t,s)&&("handshake-reply"===t.data.postmate?(clearInterval(a),r.parent.removeEventListener("message",e,!1),r.childOrigin=t.origin,n(new p(r))):i("Failed handshake"))},!1);var e=function(){d++,r.child.postMessage({postmate:"handshake",type:c,model:r.model},s),5===d&&clearInterval(a)},t=function(){e(),a=setInterval(e,500)};r.frame.attachEvent?r.frame.attachEvent("onload",t):r.frame.onload=t,r.frame.src=o})},e}();m.debug=!1,m.Promise=function(){try{return window?window.Promise:Promise}catch(e){return null}}(),m.Model=function(){function e(e){return this.child=window,this.model=e,this.parent=this.child.parent,this.sendHandshakeReply()}return e.prototype.sendHandshakeReply=function(){var s=this;return new m.Promise(function(a,r){s.child.addEventListener("message",function e(t){if(t.data.postmate){if("handshake"===t.data.postmate){s.child.removeEventListener("message",e,!1),t.source.postMessage({postmate:"handshake-reply",type:c},t.origin),s.parentOrigin=t.origin;var n=t.data.model;if(n)for(var i=Object.keys(n),o=0;o<i.length;o++)d.call(n,i[o])&&(s.model[i[o]]=n[i[o]]);return a(new h(s))}return r("Handshake Reply Failed")}},!1)})},e}(),new m.Model({}).then(function(t){var e,i,o;["onclick","onfocus","onkeyup","onscroll"].forEach(function(e){/on/.test(e)&&window.addEventListener(e.slice(2),function(e){t.emit("child-dom-events",{type:e.type,path:n.select(e.target)})})}),e=analytics,i=t,o=e.track,e.track=function(){i.emit("child-dom-events",{type:"TRACK",path:"track call"});for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];o.call.apply(o,[this].concat(t))}})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("optimal-select")):"function"==typeof define&&define.amd?define(["optimal-select"],t):t(e.select)}(this,function(n){"use strict";n="default"in n?n.default:n;var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l="application/x-postmate-v1+json",d=Object.prototype.hasOwnProperty,o=0,c=function(e,t){return e.origin===t&&("object"===i(e.data)&&("postmate"in e.data&&(e.data.type===l&&!!{"handshake-reply":1,call:1,emit:1,reply:1,request:1}[e.data.postmate])))},p=function(){function e(e){var a=this;this.parent=e.parent,this.frame=e.frame,this.child=e.child,this.childOrigin=e.childOrigin,this.events={},this.listener=function(e){var t=((e||{}).data||{}).value||{},n=t.data,i=t.name;"emit"===e.data.postmate&&i in a.events&&a.events[i].call(a,n)},this.parent.addEventListener("message",this.listener,!1)}var t=e.prototype;return t.get=function(e){var a=this;return new m.Promise(function(n){var i=++o;a.parent.addEventListener("message",function e(t){t.data.uid===i&&"reply"===t.data.postmate&&(a.parent.removeEventListener("message",e,!1),n(t.data.value))},!1),a.child.postMessage({postmate:"request",type:l,property:e,uid:i},a.childOrigin)})},t.call=function(e,t){this.child.postMessage({postmate:"call",type:l,property:e,data:t},this.childOrigin)},t.on=function(e,t){this.events[e]=t},t.destroy=function(){window.removeEventListener("message",this.listener,!1),this.frame.parentNode.removeChild(this.frame)},e}(),h=function(){function e(e){var d=this;this.model=e.model,this.parent=e.parent,this.parentOrigin=e.parentOrigin,this.child=e.child,this.child.addEventListener("message",function(t){if(c(t,d.parentOrigin)){var e,n,i,a=t.data,o=a.property,r=a.uid,s=a.data;if("call"!==t.data.postmate)(e=d.model,n=o,i="function"==typeof e[n]?e[n]():e[n],m.Promise.resolve(i)).then(function(e){return t.source.postMessage({property:o,postmate:"reply",type:l,uid:r,value:e},t.origin)});else o in d.model&&"function"==typeof d.model[o]&&d.model[o].call(d,s)}})}return e.prototype.emit=function(e,t){this.parent.postMessage({postmate:"emit",type:l,value:{name:e,data:t}},this.parentOrigin)},e}(),m=function(){function e(e){var t=void 0===e?userOptions:e,n=t.container,i=void 0===n?void 0!==i?i:document.body:n,a=t.model,o=t.url;return this.parent=window,this.frame=document.createElement("iframe"),i.appendChild(this.frame),this.child=this.frame.contentWindow||this.frame.contentDocument.parentWindow,this.model=a||{},this.sendHandshake(o)}return e.prototype.sendHandshake=function(a){var o,r=this,s=function(e){var t=document.createElement("a");t.href=e;var n=4<t.protocol.length?t.protocol:window.location.protocol,i=t.host.length?"80"===t.port||"443"===t.port?t.hostname:t.host:window.location.host;return t.origin||n+"//"+i}(a),d=0;return new e.Promise(function(n,i){r.parent.addEventListener("message",function e(t){return!!c(t,s)&&("handshake-reply"===t.data.postmate?(clearInterval(o),r.parent.removeEventListener("message",e,!1),r.childOrigin=t.origin,n(new p(r))):i("Failed handshake"))},!1);var e=function(){d++,r.child.postMessage({postmate:"handshake",type:l,model:r.model},s),5===d&&clearInterval(o)},t=function(){e(),o=setInterval(e,500)};r.frame.attachEvent?r.frame.attachEvent("onload",t):r.frame.onload=t,r.frame.src=a})},e}();m.debug=!1,m.Promise=function(){try{return window?window.Promise:Promise}catch(e){return null}}(),m.Model=function(){function e(e){return this.child=window,this.model=e,this.parent=this.child.parent,this.sendHandshakeReply()}return e.prototype.sendHandshakeReply=function(){var s=this;return new m.Promise(function(o,r){s.child.addEventListener("message",function e(t){if(t.data.postmate){if("handshake"===t.data.postmate){s.child.removeEventListener("message",e,!1),t.source.postMessage({postmate:"handshake-reply",type:l},t.origin),s.parentOrigin=t.origin;var n=t.data.model;if(n)for(var i=Object.keys(n),a=0;a<i.length;a++)d.call(n,i[a])&&(s.model[i[a]]=n[i[a]]);return o(new h(s))}return r("Handshake Reply Failed")}},!1)})},e}(),new m.Model({}).then(function(t){var e,i,a;["onclick","onfocus","onkeyup","onscroll"].forEach(function(e){/on/.test(e)&&window.addEventListener(e.slice(2),function(e){t.emit("child-dom-events",{type:e.type,path:n(e.target)})})}),e=analytics,i=t,a=e.track,e.track=function(){i.emit("child-dom-events",{type:"TRACK",path:"track call"});for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];a.call.apply(a,[this].concat(t))}})});
{
"name": "assertions-recorder",
"version": "0.0.2",
"version": "0.0.3",
"description": "a module for publishing all dom and track events to the assertions recorder application",

@@ -5,0 +5,0 @@ "main": "dist/cjs/index.js",

import Postmate from 'postmate'
import { select } from 'optimal-select'
import select from 'optimal-select'

@@ -4,0 +4,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc