New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@therms/web-js

Package Overview
Dependencies
Maintainers
4
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@therms/web-js - npm Package Compare versions

Comparing version 1.4.0 to 1.5.0

dist/utils/promises/promise-controller.d.ts

12

CHANGELOG.md

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

# [1.5.0](http://bitbucket.org/thermsio/web-js/compare/v1.4.0...v1.5.0) (2022-01-16)
### Bug Fixes
* typo ([f15b172](http://bitbucket.org/thermsio/web-js/commits/f15b1720f9d985da907b115693cbf15e7b76870f))
### Features
* add PromiseController ([1e872f7](http://bitbucket.org/thermsio/web-js/commits/1e872f72b235a676f80bc4e2d836161163378f42))
# [1.4.0](http://bitbucket.org/thermsio/web-js/compare/v1.3.5...v1.4.0) (2022-01-09)

@@ -2,0 +14,0 @@

48

dist/cjs.js

@@ -429,3 +429,45 @@ 'use strict';

const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
const DEFAULT_TIMEOUT = 30000;
class PromiseTimeoutError extends Error {
}
/**
* This is a utility for creating a promise and marking it as resolved/rejected from some external logic.
*/
class PromiseController {
rejectPromise;
resolvePromise;
promise;
constructor(timeout) {
this.promise = new Promise((resolve, reject) => {
const timer = setTimeout(() => {
reject(new PromiseTimeoutError('PromiseWraper timeout'));
}, timeout || DEFAULT_TIMEOUT);
this.rejectPromise = (arg) => {
clearTimeout(timer);
reject(arg);
};
this.resolvePromise = (arg) => {
clearTimeout(timer);
resolve(arg);
};
});
}
reject = (rejectReturnValue) => {
if (this.rejectPromise) {
this.rejectPromise(rejectReturnValue);
}
else {
console.error(`PromiseController#rejectPromise does not exist`);
}
};
resolve = (resolveReturnValue) => {
if (this.resolvePromise) {
this.resolvePromise(resolveReturnValue);
}
else {
console.error(`PromiseController#resolvePromise does not exist`);
}
};
}
function retryPromise(fn, retryCount = 5, interval = 1000) {

@@ -450,2 +492,4 @@ return new Promise((resolve, reject) => {

const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
function isPlural(array = [], text = '', postfix = 's') {

@@ -461,2 +505,4 @@ if (Array.isArray(array) && array.length > 1)

exports.PromiseController = PromiseController;
exports.PromiseTimeoutError = PromiseTimeoutError;
exports.Vent = Vent;

@@ -463,0 +509,0 @@ exports.b2bComms = b2bComms;

4

dist/index.d.ts

@@ -9,4 +9,6 @@ export * from './services/browser-focus';

export * from './utils/device';
export * from './utils/promises';
export * from './utils/promises/promise-controller';
export * from './utils/promises/retry-promise';
export * from './utils/promises/sleep';
export * from './utils/strings';
export * from './services/vent';

@@ -9,5 +9,7 @@ export { checkIsBrowserVisible, onBrowserFocusChange } from './services/browser-focus.js';

export { getDevice, isMobileDevice } from './utils/device.js';
export { retryPromise, sleep } from './utils/promises.js';
export { PromiseController, PromiseTimeoutError } from './utils/promises/promise-controller.js';
export { retryPromise } from './utils/promises/retry-promise.js';
export { sleep } from './utils/promises/sleep.js';
export { isPlural } from './utils/strings.js';
export { Vent, globalVent } from './services/vent.js';
//# sourceMappingURL=index.js.map
{
"name": "@therms/web-js",
"version": "1.4.0",
"version": "1.5.0",
"description": "Common web/JS tools & utilities",

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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