Socket
Socket
Sign inDemoInstall

waitasecond

Package Overview
Dependencies
Maintainers
1
Versions
112
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

waitasecond - npm Package Compare versions

Comparing version 1.11.1 to 1.11.15

assets/ai/wallpaper/current

0

.eslintrc.js

@@ -0,0 +0,0 @@ module.exports = {

{}

@@ -0,0 +0,0 @@ import { forAllImagesInElement } from '../../src/functions/forAllImagesInElement';

@@ -0,0 +0,0 @@ /// <reference types="cypress" />

@@ -0,0 +0,0 @@ import { addMatchImageSnapshotCommand } from 'cypress-image-snapshot/command';

@@ -0,0 +0,0 @@ // ***********************************************************

@@ -0,0 +0,0 @@ {

export declare function forAllImagesInElement(element: HTMLElement): Promise<void>;
/**
* TODO: forAllImagesInElement should be internally using forImage
* TODO: forAllImagesInElement should be able to recieve an <img> element
* TODO: forAllImagesInElement should be able to recieve just an <img> element
* TODO: Rename to forImagesReady OR forMediaReady
* TODO: Timeout by chaining
* TODO: rejectWhenNotLoaded by chaining
* TODO: Corrupted images into samples
* TODO: Also with media and pictures
* TODO: Universal for every loadable think
* TODO: Also start new wait when new images appears / disappears during the wait
* TODO: [0] Verbose mode for logging
* TODO: Make special error - ImageError and put imgElement as extra data of ImageError
*/

43

dist/functions/forAllImagesInElement.js
"use strict";
/*
TODO: !!! Rename forImagesReady, forMediaReady
TODO: !!! Timeout by chaining
TODO: !!! rejectWhenNotLoaded by chaining
TODO: !!! Corrupted images into samples
TODO: !!! Also with media and pictures
TODO: !!! Universal for every loadable think
TODO: !!! Also start new wait when new images appears / disappears during the wait
TODO: Verbose mode for console.info
*/
// tslint:disable:no-console
exports.__esModule = true;
exports.forAllImagesInElement = void 0;
// tslint:disable:no-console
function forAllImagesInElement(element) {
return Promise.all(Array.from(element.querySelectorAll('img')).map(function (imageElement /*, i*/) {
// !!!!! BEFORE ANY CHANGE HERE> TODO: forAllImagesInElement should be internally using forImage
// TODO: BEFORE ANY CHANGE HERE forAllImagesInElement should be internally using forImage
return new Promise(function (resolve, reject) {

@@ -22,11 +12,12 @@ if (imageElement.complete) {

/*
console.info(
`Image ${i} rejected due to 0 naturalHeight`,
);
*/
// TODO: !!! Check this also in load
TODO: [0]
console.info(
`Image ${i} rejected due to 0 naturalHeight`,
);
*/
// TODO: Check this also in load
reject(imageElement);
}
else {
// console.info(`Image ${i} is already completed`);
// TODO: [0]> console.info(`Image ${i} is already completed`);
resolve();

@@ -36,8 +27,7 @@ }

imageElement.addEventListener('load', function () {
// console.info(`Image ${i} resolved`);
// TODO: [0]> console.info(`Image ${i} resolved`);
resolve();
});
imageElement.addEventListener('error', function () {
// console.info(`Image ${i} rejected`);
// TODO: !!! imgElement into ImageError
// TODO: [0]> console.info(`Image ${i} rejected`);
reject(new Error("Some images can`t be loaded."));

@@ -53,3 +43,12 @@ });

* TODO: forAllImagesInElement should be internally using forImage
* TODO: forAllImagesInElement should be able to recieve an <img> element
* TODO: forAllImagesInElement should be able to recieve just an <img> element
* TODO: Rename to forImagesReady OR forMediaReady
* TODO: Timeout by chaining
* TODO: rejectWhenNotLoaded by chaining
* TODO: Corrupted images into samples
* TODO: Also with media and pictures
* TODO: Universal for every loadable think
* TODO: Also start new wait when new images appears / disappears during the wait
* TODO: [0] Verbose mode for logging
* TODO: Make special error - ImageError and put imgElement as extra data of ImageError
*/

@@ -0,0 +0,0 @@ {

{
"name": "waitasecond",
"version": "1.11.1",
"description": "Wait a second is an extremely simple and elegant tool for using working with async code and Promises. It is usable by browser, worker, and node environment and fully typed.",
"version": "1.11.15",
"description": "Waitasecond is a javascript library that makes managing async code and Promises simple and elegant. It provides an await-like API that can be used in the browser, worker, and node environment, making it a powerful tool for any project. Additionally, the library is fully typed, allowing developers to have complete confidence in the reliability of their code. With Waitasecond, developers can easily and reliably handle any asynchronous task with ease.",
"sideEffects": false,

@@ -91,3 +91,2 @@ "main": "./dist/main.js",

"cypress": "8.4.0",
"cypress-image-snapshot": "4.0.1",
"express": "4.17.1",

@@ -94,0 +93,0 @@ "express-throttle-bandwidth": "1.0.1",

@@ -16,4 +16,11 @@ # ⏰ Waitasecond

Wait a second is an extremely simple and elegant tool for using **working with async code and [Promises](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)**. It is usable by browser, worker, and node environment and fully typed.
Waitasecond is a javascript library that makes managing **async code and [Promises](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)** simple and elegant. It provides an await-like API that can be used in the browser, worker, and node environment, making it a powerful tool for any project. Additionally, the library is fully typed, allowing developers to have complete confidence in the reliability of their code. With Waitasecond, developers can easily and reliably handle any asynchronous task with ease.
<!--Wallpaper-->
<!--⚠️WARNING: This section was generated by https://github.com/hejny/batch-project-editor/blob/main/src//workflows/315-ai-generated-wallpaper/4-aiGeneratedWallpaperUseInReadme.ts so every manual change will be overwritten.-->
[![Wallpaper of ⏰ Waitasecond](assets/ai/wallpaper/gallery/43a3e1f3-bde0-4747-bf6b-04158e54f112-0_0.png)](https://www.midjourney.com/app/jobs/43a3e1f3-bde0-4747-bf6b-04158e54f112)
<!--/Wallpaper-->
## 🔥 Install

@@ -197,11 +204,11 @@

<a href="https://collboard.com/">
<img src="https://collboard.fra1.cdn.digitaloceanspaces.com/assets/18.12.1/logo-small.png" alt="Collboard logo" width="50" />
<img src="https://collboard.fra1.cdn.digitaloceanspaces.com/assets/18.12.1/logo-small.png" alt="Collboard logo" width="50" />
</a>
&nbsp;&nbsp;&nbsp;
<a href="https://czech.events/">
<img src="https://czech.events/design/logos/czech.events.transparent-logo.png" alt="Czech.events logo" width="50" />
<img src="https://czech.events/design/logos/czech.events.transparent-logo.png" alt="Czech.events logo" width="50" />
</a>
&nbsp;&nbsp;&nbsp;
<a href="https://sigmastamp.ml/">
<img src="https://www.sigmastamp.ml/sigmastamp-logo.white.svg" alt="SigmaStamp logo" width="50" />
<img src="https://www.sigmastamp.ml/sigmastamp-logo.white.svg" alt="SigmaStamp logo" width="50" />
</a>

@@ -208,0 +215,0 @@

@@ -0,0 +0,0 @@ // TODO: !!! Import

@@ -0,0 +0,0 @@ /* tslint:disable:no-conditional-assignment */

{
"name": "generate-main-exports"
}

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

/*
TODO: !!! Rename forImagesReady, forMediaReady
TODO: !!! Timeout by chaining
TODO: !!! rejectWhenNotLoaded by chaining
TODO: !!! Corrupted images into samples
TODO: !!! Also with media and pictures
TODO: !!! Universal for every loadable think
TODO: !!! Also start new wait when new images appears / disappears during the wait
TODO: Verbose mode for console.info
*/
// tslint:disable:no-console

@@ -18,3 +7,3 @@

(imageElement /*, i*/) => {
// !!!!! BEFORE ANY CHANGE HERE> TODO: forAllImagesInElement should be internally using forImage
// TODO: BEFORE ANY CHANGE HERE forAllImagesInElement should be internally using forImage

@@ -25,11 +14,12 @@ return new Promise((resolve, reject) => {

/*
console.info(
`Image ${i} rejected due to 0 naturalHeight`,
);
*/
TODO: [0]
console.info(
`Image ${i} rejected due to 0 naturalHeight`,
);
*/
// TODO: !!! Check this also in load
// TODO: Check this also in load
reject(imageElement);
} else {
// console.info(`Image ${i} is already completed`);
// TODO: [0]> console.info(`Image ${i} is already completed`);
resolve();

@@ -40,8 +30,7 @@ }

imageElement.addEventListener('load', () => {
// console.info(`Image ${i} resolved`);
// TODO: [0]> console.info(`Image ${i} resolved`);
resolve();
});
imageElement.addEventListener('error', () => {
// console.info(`Image ${i} rejected`);
// TODO: !!! imgElement into ImageError
// TODO: [0]> console.info(`Image ${i} rejected`);
reject(new Error(`Some images can\`t be loaded.`));

@@ -59,3 +48,12 @@ });

* TODO: forAllImagesInElement should be internally using forImage
* TODO: forAllImagesInElement should be able to recieve an <img> element
* TODO: forAllImagesInElement should be able to recieve just an <img> element
* TODO: Rename to forImagesReady OR forMediaReady
* TODO: Timeout by chaining
* TODO: rejectWhenNotLoaded by chaining
* TODO: Corrupted images into samples
* TODO: Also with media and pictures
* TODO: Universal for every loadable think
* TODO: Also start new wait when new images appears / disappears during the wait
* TODO: [0] Verbose mode for logging
* TODO: Make special error - ImageError and put imgElement as extra data of ImageError
*/

@@ -0,0 +0,0 @@ {

{
"extends": ["tslint:recommended", "tslint-config-prettier"]
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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