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

@applitools/dom-shared

Package Overview
Dependencies
Maintainers
23
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@applitools/dom-shared - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

12

CHANGELOG.md
# Changelog
## Unreleased
## 1.0.3 - 2020/9/22
- removed rest arguments syntax
## 1.0.2 - 2020/9/22
- chunkify, pollify, poll
# Changelog
## Unreleased
{
"name": "@applitools/dom-shared",
"version": "1.0.2",
"version": "1.0.3",
"main": "index.js",

@@ -5,0 +5,0 @@ "license": "SEE LICENSE IN LICENSE",

const poll = require('./poll');
function pollify(script, context = {}, key = 'state') {
return options => (...args) => {
if (!context[key]) {
context[key] = {};
script(args)
.then(value => (context[key].value = value))
.catch(err => (context[key].error = err.message));
}
return poll(context, key, options);
};
return options =>
function() {
if (!context[key]) {
context[key] = {};
script
.apply(null, arguments)
.then(value => (context[key].value = value))
.catch(err => (context[key].error = err.message));
}
return poll(context, key, options);
};
}
module.exports = pollify;

@@ -8,9 +8,9 @@ const assert = require('assert');

it('works', async () => {
const func = () => new Promise(resolve => setTimeout(resolve, 100, 'result'));
const func = result => new Promise(resolve => setTimeout(resolve, 100, result));
const funcPoll = pollify(func, {context: {}, key: 'key'})();
assert.strictEqual(typeof func, 'function');
const r = funcPoll();
const r = funcPoll('result');
assert.deepStrictEqual(r, {status: 'WIP'});
await delay(100);
const r2 = funcPoll();
const r2 = funcPoll('result 2');
assert.deepStrictEqual(r2, {status: 'SUCCESS', value: 'result'});

@@ -17,0 +17,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