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

@defer.run/client

Package Overview
Dependencies
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@defer.run/client - npm Package Compare versions

Comparing version 0.4.0-alpha-20230202153019-86bc7f8 to 0.4.0-alpha-20230202153941-61d314d

56

cjs/index.js

@@ -90,27 +90,2 @@ "use strict";

};
// EXAMPLES:
// interface Contact {
// id: string;
// name: string;
// }
// const importContacts = (companyId: string, contacts: Contact[]) => {
// return new Promise<{ imported: number; companyId: string }>((resolve) => {
// console.log(`Start importing contacts for company#${companyId}`);
// setTimeout(() => {
// console.log(contacts);
// console.log("Done.");
// resolve({ imported: 10000, companyId });
// }, 5000);
// });
// };
// const importContactsD = defer(importContacts);
// async function myFunction() {
// return 1;
// }
// defer.schedule(myFunction, "every day");
// async function test() {
// await importContactsD("1", []); // fire and forget
// await importContactsD.await("1", []); // wait for execution result
// await importContactsD.delayed("1", [], { delay: "2 days" }); // scheduled
// }
/**

@@ -123,3 +98,5 @@ * Delay the execution of a background function

*/
const delay = (deferFn, delay) => (...args) => {
const delay = (deferFn, delay) =>
// @ts-expect-error (charly) to fix
(...args) => {
const fn = deferFn.__fn;

@@ -145,3 +122,28 @@ if (debug) {

exports.delay = delay;
// EXAMPLES:
// interface Contact {
// id: string;
// name: string;
// }
// const importContacts = (companyId: string, contacts: Contact[]) => {
// return new Promise<{ imported: number; companyId: string }>((resolve) => {
// console.log(`Start importing contacts for company#${companyId}`);
// setTimeout(() => {
// console.log(contacts);
// console.log("Done.");
// resolve({ imported: 10000, companyId });
// }, 5000);
// });
// };
// const importContactsD = defer(importContacts);
// async function myFunction() {
// return 1;
// }
// defer.schedule(myFunction, "every day");
// async function test() {
// await importContactsD("1", []); // fire and forget
// await importContactsD.await("1", []); // wait for execution result
// await importContactsD.delayed("1", [], { delay: "2 days" }); // scheduled
// }
// const delayed = delay(importContactsD, '1h')
// delayed()
// delayed('', [])

@@ -81,27 +81,2 @@ // @ts-expect-error untyped dep

};
// EXAMPLES:
// interface Contact {
// id: string;
// name: string;
// }
// const importContacts = (companyId: string, contacts: Contact[]) => {
// return new Promise<{ imported: number; companyId: string }>((resolve) => {
// console.log(`Start importing contacts for company#${companyId}`);
// setTimeout(() => {
// console.log(contacts);
// console.log("Done.");
// resolve({ imported: 10000, companyId });
// }, 5000);
// });
// };
// const importContactsD = defer(importContacts);
// async function myFunction() {
// return 1;
// }
// defer.schedule(myFunction, "every day");
// async function test() {
// await importContactsD("1", []); // fire and forget
// await importContactsD.await("1", []); // wait for execution result
// await importContactsD.delayed("1", [], { delay: "2 days" }); // scheduled
// }
/**

@@ -114,3 +89,5 @@ * Delay the execution of a background function

*/
export const delay = (deferFn, delay) => (...args) => {
export const delay = (deferFn, delay) =>
// @ts-expect-error (charly) to fix
(...args) => {
const fn = deferFn.__fn;

@@ -135,3 +112,28 @@ if (debug) {

};
// EXAMPLES:
// interface Contact {
// id: string;
// name: string;
// }
// const importContacts = (companyId: string, contacts: Contact[]) => {
// return new Promise<{ imported: number; companyId: string }>((resolve) => {
// console.log(`Start importing contacts for company#${companyId}`);
// setTimeout(() => {
// console.log(contacts);
// console.log("Done.");
// resolve({ imported: 10000, companyId });
// }, 5000);
// });
// };
// const importContactsD = defer(importContacts);
// async function myFunction() {
// return 1;
// }
// defer.schedule(myFunction, "every day");
// async function test() {
// await importContactsD("1", []); // fire and forget
// await importContactsD.await("1", []); // wait for execution result
// await importContactsD.delayed("1", [], { delay: "2 days" }); // scheduled
// }
// const delayed = delay(importContactsD, '1h')
// delayed()
// delayed('', [])
{
"name": "@defer.run/client",
"version": "0.4.0-alpha-20230202153019-86bc7f8",
"version": "0.4.0-alpha-20230202153941-61d314d",
"description": "cua JavaScript client",

@@ -5,0 +5,0 @@ "dependencies": {

@@ -51,2 +51,2 @@ import type { Units } from "parse-duration";

*/
export declare const delay: <F extends (...args: any | undefined) => Promise<any>>(deferFn: DeferRetFn<F>, delay: DelayString | Date) => () => F;
export declare const delay: <F extends (...args: any | undefined) => Promise<any>>(deferFn: DeferRetFn<F>, delay: DelayString | Date) => F;

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