Socket
Socket
Sign inDemoInstall

abortjs

Package Overview
Dependencies
2
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.1 to 0.0.2

CHANGELOG.md

45

dist/cjs/core/abort-js.js

@@ -11,8 +11,12 @@ "use strict";

};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AbortJS = void 0;
const events_1 = require("./events");
const errors_1 = require("../errors/errors");
const arrays_1 = require("../utils/arrays");
const types_1 = require("../utils/types");
const errors_1 = require("../errors/errors");
const abort_controller_1 = __importDefault(require("abort-controller"));
class AbortJS {

@@ -22,6 +26,6 @@ static watch(name, callback) {

if (!(0, types_1.isString)(name)) {
throw new Error(errors_1.errors.NOT_STRING(name));
throw new Error((0, errors_1.NOT_STRING)(name));
}
if (!(0, types_1.isFn)(callback)) {
throw new Error(errors_1.errors.NOT_FN(callback));
throw new Error((0, errors_1.NOT_FN)(callback));
}

@@ -35,3 +39,3 @@ this.remove(name, true);

if (!(0, types_1.isArray)(collection)) {
throw new Error(errors_1.errors.NOT_ARRAY(collection));
throw new Error((0, errors_1.NOT_ARRAY)(collection));
}

@@ -42,10 +46,10 @@ const watchHash = {};

if (!(0, arrays_1.lengthOf)(chunk, 2)) {
throw new Error(errors_1.errors.WRONG_LENGTH(collection, 2));
throw new Error((0, errors_1.WRONG_LENGTH)(collection, 2));
}
const [name, callback] = chunk;
if (!(0, types_1.isString)(name)) {
throw new Error(errors_1.errors.NOT_STRING(name));
throw new Error((0, errors_1.NOT_STRING)(name));
}
if (!(0, types_1.isFn)(callback)) {
throw new Error(errors_1.errors.NOT_FN(callback));
throw new Error((0, errors_1.NOT_FN)(callback));
}

@@ -64,3 +68,3 @@ if (watchHash[name]) {

if (!(0, types_1.isString)(name)) {
throw new Error(errors_1.errors.NOT_STRING(name));
throw new Error((0, errors_1.NOT_STRING)(name));
}

@@ -74,3 +78,3 @@ if (this.controllers[name]) {

if (!(0, types_1.isString)(name)) {
throw new Error(errors_1.errors.NOT_STRING(name));
throw new Error((0, errors_1.NOT_STRING)(name));
}

@@ -81,5 +85,10 @@ return this.controllers[name];

if (!(0, types_1.isString)(name)) {
throw new Error(errors_1.errors.NOT_STRING(name));
throw new Error((0, errors_1.NOT_STRING)(name));
}
this.controllers[name] = new AbortController();
if (!AbortController) {
this.controllers[name] = new abort_controller_1.default();
}
else {
this.controllers[name] = new AbortController();
}
events_1.Events.emit('create', { controller: name });

@@ -89,3 +98,3 @@ }

if ((0, types_1.isDefined)(abort) && !(0, types_1.isBoolean)(abort)) {
throw new Error(errors_1.errors.NOT_BOOLEAN(abort, true));
throw new Error((0, errors_1.NOT_BOOLEAN)(abort, true));
}

@@ -98,6 +107,6 @@ for (const controller in this.controllers) {

if (!(0, types_1.isString)(name)) {
throw new Error(errors_1.errors.NOT_STRING(name));
throw new Error((0, errors_1.NOT_STRING)(name));
}
if ((0, types_1.isDefined)(abort) && !(0, types_1.isBoolean)(abort)) {
throw new Error(errors_1.errors.NOT_BOOLEAN(abort, true));
throw new Error((0, errors_1.NOT_BOOLEAN)(abort, true));
}

@@ -115,6 +124,6 @@ if (this.controllers[name]) {

if (!(0, types_1.isString)(event)) {
throw new Error(errors_1.errors.NOT_STRING(event));
throw new Error((0, errors_1.NOT_STRING)(event));
}
if (!(0, types_1.isFn)(callback)) {
throw new Error(errors_1.errors.NOT_FN(callback));
throw new Error((0, errors_1.NOT_FN)(callback));
}

@@ -125,6 +134,6 @@ events_1.Events.add(event, callback);

if (!(0, types_1.isString)(event)) {
throw new Error(errors_1.errors.NOT_STRING(event));
throw new Error((0, errors_1.NOT_STRING)(event));
}
if (!(0, types_1.isFn)(callback)) {
throw new Error(errors_1.errors.NOT_FN(callback));
throw new Error((0, errors_1.NOT_FN)(callback));
}

@@ -131,0 +140,0 @@ events_1.Events.remove(event, callback);

18

dist/cjs/core/events.js

@@ -11,9 +11,9 @@ "use strict";

if (!(0, types_1.isString)(event)) {
throw new Error(errors_1.errors.NOT_STRING(event));
throw new Error((0, errors_1.NOT_STRING)(event));
}
if (!(0, types_1.isFn)(callback)) {
throw new Error(errors_1.errors.NOT_FN(callback));
throw new Error((0, errors_1.NOT_FN)(callback));
}
if (!this.events[event]) {
throw new Error(errors_1.errors.WRONG_EVENT(event));
throw new Error((0, errors_1.WRONG_EVENT)(event));
}

@@ -24,9 +24,9 @@ this.events[event].push(callback);

if (!(0, types_1.isString)(event)) {
throw new Error(errors_1.errors.NOT_STRING(event));
throw new Error((0, errors_1.NOT_STRING)(event));
}
if (!(0, types_1.isObject)(data)) {
throw new Error(errors_1.errors.NOT_OBJECT(data));
throw new Error((0, errors_1.NOT_OBJECT)(data));
}
if (!this.events[event]) {
throw new Error(errors_1.errors.WRONG_EVENT(event));
throw new Error((0, errors_1.WRONG_EVENT)(event));
}

@@ -38,9 +38,9 @@ (0, objects_1.compareObject)(data, events_constants_1.eventDataShape);

if (!(0, types_1.isString)(event)) {
throw new Error(errors_1.errors.NOT_STRING(event));
throw new Error((0, errors_1.NOT_STRING)(event));
}
if (!(0, types_1.isFn)(callback)) {
throw new Error(errors_1.errors.NOT_FN(callback));
throw new Error((0, errors_1.NOT_FN)(callback));
}
if (!this.events[event]) {
throw new Error(errors_1.errors.WRONG_EVENT(event));
throw new Error((0, errors_1.WRONG_EVENT)(event));
}

@@ -47,0 +47,0 @@ const index = this.events[event].indexOf(callback);

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.errors = void 0;
exports.WRONG_OBJ_KEY = exports.WRONG_OBJ_VAL = exports.NOT_OBJ_KEY = exports.WRONG_EVENT = exports.WRONG_LENGTH = exports.NOT_FN = exports.NOT_OBJECT = exports.NOT_ARRAY = exports.NOT_BOOLEAN = exports.NOT_STRING = void 0;
const prefix = 'AbortJS -';
exports.errors = {
NOT_STRING(value, partial) {
return `${prefix} Expected a ${partial ? 'string or undefined' : 'string'} value, instead received '${typeof value}'.`;
},
NOT_BOOLEAN(value, partial) {
return `${prefix} Expected a ${partial ? 'boolean or undefined' : 'boolean'} value, instead received '${typeof value}'.`;
},
NOT_ARRAY(value, partial) {
return `${prefix} Expected an ${partial ? 'array or undefined' : 'array'} value, instead received '${typeof value}'.`;
},
NOT_OBJECT(value, partial) {
return `${prefix} Expected an ${partial ? 'object or undefined' : 'object'} value, instead received '${typeof value}'.`;
},
NOT_FN(value, partial) {
return `${prefix} Expected a ${partial ? 'callback funcion or undefined' : 'callback function'}, instead received '${typeof value}'.`;
},
WRONG_LENGTH(array, amount) {
return `${prefix} Expected an array with a length of ${amount}, instead received an array with ${array.length} items.`;
},
WRONG_EVENT(event) {
return `${prefix} Expected a valid event name, instead received '${event}'.`;
},
NOT_OBJ_KEY(key, shape) {
return `${prefix} Key '${key}' doesn't exist on object but it was defined as required in shape. Valid keys: ["${Object.keys(shape).join('", "')}"].`;
},
WRONG_OBJ_VAL(val, key, expected) {
return `${prefix} Value of '${key}' doesn't match the defined in shape (${key}: ${expected}), instead received '${typeof val}'.`;
},
WRONG_OBJ_KEY(key, shape) {
return `${prefix} Key '${key}' doesn't exist on shape but it was defined in object. Valid keys: ["${Object.keys(shape).join('", "')}"].`;
},
const NOT_STRING = (value, partial) => {
return `${prefix} Expected a ${partial ? 'string or undefined' : 'string'} value, instead received '${typeof value}'.`;
};
exports.NOT_STRING = NOT_STRING;
const NOT_BOOLEAN = (value, partial) => {
return `${prefix} Expected a ${partial ? 'boolean or undefined' : 'boolean'} value, instead received '${typeof value}'.`;
};
exports.NOT_BOOLEAN = NOT_BOOLEAN;
const NOT_ARRAY = (value, partial) => {
return `${prefix} Expected an ${partial ? 'array or undefined' : 'array'} value, instead received '${typeof value}'.`;
};
exports.NOT_ARRAY = NOT_ARRAY;
const NOT_OBJECT = (value, partial) => {
return `${prefix} Expected an ${partial ? 'object or undefined' : 'object'} value, instead received '${typeof value}'.`;
};
exports.NOT_OBJECT = NOT_OBJECT;
const NOT_FN = (value, partial) => {
return `${prefix} Expected a ${partial ? 'callback funcion or undefined' : 'callback function'}, instead received '${typeof value}'.`;
};
exports.NOT_FN = NOT_FN;
const WRONG_LENGTH = (array, amount) => {
return `${prefix} Expected an array with a length of ${amount}, instead received an array with ${array.length} items.`;
};
exports.WRONG_LENGTH = WRONG_LENGTH;
const WRONG_EVENT = (event) => {
return `${prefix} Expected a valid event name, instead received '${event}'.`;
};
exports.WRONG_EVENT = WRONG_EVENT;
const NOT_OBJ_KEY = (key, shape) => {
return `${prefix} Key '${key}' doesn't exist on object but it was defined as required in shape. Valid keys: ["${Object.keys(shape).join('", "')}"].`;
};
exports.NOT_OBJ_KEY = NOT_OBJ_KEY;
const WRONG_OBJ_VAL = (val, key, expected) => {
return `${prefix} Value of '${key}' doesn't match the defined in shape (${key}: ${expected}), instead received '${typeof val}'.`;
};
exports.WRONG_OBJ_VAL = WRONG_OBJ_VAL;
const WRONG_OBJ_KEY = (key, shape) => {
return `${prefix} Key '${key}' doesn't exist on shape but it was defined in object. Valid keys: ["${Object.keys(shape).join('", "')}"].`;
};
exports.WRONG_OBJ_KEY = WRONG_OBJ_KEY;

@@ -10,3 +10,3 @@ "use strict";

if (shape[key] === undefined) {
throw new Error(errors_1.errors.WRONG_OBJ_KEY(key, shape));
throw new Error((0, errors_1.WRONG_OBJ_KEY)(key, shape));
}

@@ -16,3 +16,3 @@ });

if (test[key] === undefined) {
throw new Error(errors_1.errors.NOT_OBJ_KEY(key, shape));
throw new Error((0, errors_1.NOT_OBJ_KEY)(key, shape));
}

@@ -22,3 +22,3 @@ });

if (!shape[key].val(test[key])) {
throw new Error(errors_1.errors.WRONG_OBJ_VAL(test[key], key, shape[key].expected));
throw new Error((0, errors_1.WRONG_OBJ_VAL)(test[key], key, shape[key].expected));
}

@@ -25,0 +25,0 @@ });

@@ -11,5 +11,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

import { Events } from './events';
import { errors } from '../errors/errors';
import { lengthOf } from '../utils/arrays';
import { isArray, isBoolean, isDefined, isFn, isString } from '../utils/types';
import { NOT_ARRAY, NOT_BOOLEAN, NOT_FN, NOT_STRING, WRONG_LENGTH } from '../errors/errors';
import _abortPolyfill from 'abort-controller';
export class AbortJS {

@@ -19,6 +20,6 @@ static watch(name, callback) {

if (!isString(name)) {
throw new Error(errors.NOT_STRING(name));
throw new Error(NOT_STRING(name));
}
if (!isFn(callback)) {
throw new Error(errors.NOT_FN(callback));
throw new Error(NOT_FN(callback));
}

@@ -32,3 +33,3 @@ this.remove(name, true);

if (!isArray(collection)) {
throw new Error(errors.NOT_ARRAY(collection));
throw new Error(NOT_ARRAY(collection));
}

@@ -39,10 +40,10 @@ const watchHash = {};

if (!lengthOf(chunk, 2)) {
throw new Error(errors.WRONG_LENGTH(collection, 2));
throw new Error(WRONG_LENGTH(collection, 2));
}
const [name, callback] = chunk;
if (!isString(name)) {
throw new Error(errors.NOT_STRING(name));
throw new Error(NOT_STRING(name));
}
if (!isFn(callback)) {
throw new Error(errors.NOT_FN(callback));
throw new Error(NOT_FN(callback));
}

@@ -61,3 +62,3 @@ if (watchHash[name]) {

if (!isString(name)) {
throw new Error(errors.NOT_STRING(name));
throw new Error(NOT_STRING(name));
}

@@ -71,3 +72,3 @@ if (this.controllers[name]) {

if (!isString(name)) {
throw new Error(errors.NOT_STRING(name));
throw new Error(NOT_STRING(name));
}

@@ -78,5 +79,10 @@ return this.controllers[name];

if (!isString(name)) {
throw new Error(errors.NOT_STRING(name));
throw new Error(NOT_STRING(name));
}
this.controllers[name] = new AbortController();
if (!AbortController) {
this.controllers[name] = new _abortPolyfill();
}
else {
this.controllers[name] = new AbortController();
}
Events.emit('create', { controller: name });

@@ -86,3 +92,3 @@ }

if (isDefined(abort) && !isBoolean(abort)) {
throw new Error(errors.NOT_BOOLEAN(abort, true));
throw new Error(NOT_BOOLEAN(abort, true));
}

@@ -95,6 +101,6 @@ for (const controller in this.controllers) {

if (!isString(name)) {
throw new Error(errors.NOT_STRING(name));
throw new Error(NOT_STRING(name));
}
if (isDefined(abort) && !isBoolean(abort)) {
throw new Error(errors.NOT_BOOLEAN(abort, true));
throw new Error(NOT_BOOLEAN(abort, true));
}

@@ -112,6 +118,6 @@ if (this.controllers[name]) {

if (!isString(event)) {
throw new Error(errors.NOT_STRING(event));
throw new Error(NOT_STRING(event));
}
if (!isFn(callback)) {
throw new Error(errors.NOT_FN(callback));
throw new Error(NOT_FN(callback));
}

@@ -122,6 +128,6 @@ Events.add(event, callback);

if (!isString(event)) {
throw new Error(errors.NOT_STRING(event));
throw new Error(NOT_STRING(event));
}
if (!isFn(callback)) {
throw new Error(errors.NOT_FN(callback));
throw new Error(NOT_FN(callback));
}

@@ -128,0 +134,0 @@ Events.remove(event, callback);

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

import { errors } from '../errors/errors';
import { NOT_FN, NOT_OBJECT, NOT_STRING, WRONG_EVENT } from '../errors/errors';
import { compareObject } from '../utils/objects';

@@ -8,9 +8,9 @@ import { isFn, isObject, isString } from '../utils/types';

if (!isString(event)) {
throw new Error(errors.NOT_STRING(event));
throw new Error(NOT_STRING(event));
}
if (!isFn(callback)) {
throw new Error(errors.NOT_FN(callback));
throw new Error(NOT_FN(callback));
}
if (!this.events[event]) {
throw new Error(errors.WRONG_EVENT(event));
throw new Error(WRONG_EVENT(event));
}

@@ -21,9 +21,9 @@ this.events[event].push(callback);

if (!isString(event)) {
throw new Error(errors.NOT_STRING(event));
throw new Error(NOT_STRING(event));
}
if (!isObject(data)) {
throw new Error(errors.NOT_OBJECT(data));
throw new Error(NOT_OBJECT(data));
}
if (!this.events[event]) {
throw new Error(errors.WRONG_EVENT(event));
throw new Error(WRONG_EVENT(event));
}

@@ -35,9 +35,9 @@ compareObject(data, eventDataShape);

if (!isString(event)) {
throw new Error(errors.NOT_STRING(event));
throw new Error(NOT_STRING(event));
}
if (!isFn(callback)) {
throw new Error(errors.NOT_FN(callback));
throw new Error(NOT_FN(callback));
}
if (!this.events[event]) {
throw new Error(errors.WRONG_EVENT(event));
throw new Error(WRONG_EVENT(event));
}

@@ -44,0 +44,0 @@ const index = this.events[event].indexOf(callback);

const prefix = 'AbortJS -';
export const errors = {
NOT_STRING(value, partial) {
return `${prefix} Expected a ${partial ? 'string or undefined' : 'string'} value, instead received '${typeof value}'.`;
},
NOT_BOOLEAN(value, partial) {
return `${prefix} Expected a ${partial ? 'boolean or undefined' : 'boolean'} value, instead received '${typeof value}'.`;
},
NOT_ARRAY(value, partial) {
return `${prefix} Expected an ${partial ? 'array or undefined' : 'array'} value, instead received '${typeof value}'.`;
},
NOT_OBJECT(value, partial) {
return `${prefix} Expected an ${partial ? 'object or undefined' : 'object'} value, instead received '${typeof value}'.`;
},
NOT_FN(value, partial) {
return `${prefix} Expected a ${partial ? 'callback funcion or undefined' : 'callback function'}, instead received '${typeof value}'.`;
},
WRONG_LENGTH(array, amount) {
return `${prefix} Expected an array with a length of ${amount}, instead received an array with ${array.length} items.`;
},
WRONG_EVENT(event) {
return `${prefix} Expected a valid event name, instead received '${event}'.`;
},
NOT_OBJ_KEY(key, shape) {
return `${prefix} Key '${key}' doesn't exist on object but it was defined as required in shape. Valid keys: ["${Object.keys(shape).join('", "')}"].`;
},
WRONG_OBJ_VAL(val, key, expected) {
return `${prefix} Value of '${key}' doesn't match the defined in shape (${key}: ${expected}), instead received '${typeof val}'.`;
},
WRONG_OBJ_KEY(key, shape) {
return `${prefix} Key '${key}' doesn't exist on shape but it was defined in object. Valid keys: ["${Object.keys(shape).join('", "')}"].`;
},
export const NOT_STRING = (value, partial) => {
return `${prefix} Expected a ${partial ? 'string or undefined' : 'string'} value, instead received '${typeof value}'.`;
};
export const NOT_BOOLEAN = (value, partial) => {
return `${prefix} Expected a ${partial ? 'boolean or undefined' : 'boolean'} value, instead received '${typeof value}'.`;
};
export const NOT_ARRAY = (value, partial) => {
return `${prefix} Expected an ${partial ? 'array or undefined' : 'array'} value, instead received '${typeof value}'.`;
};
export const NOT_OBJECT = (value, partial) => {
return `${prefix} Expected an ${partial ? 'object or undefined' : 'object'} value, instead received '${typeof value}'.`;
};
export const NOT_FN = (value, partial) => {
return `${prefix} Expected a ${partial ? 'callback funcion or undefined' : 'callback function'}, instead received '${typeof value}'.`;
};
export const WRONG_LENGTH = (array, amount) => {
return `${prefix} Expected an array with a length of ${amount}, instead received an array with ${array.length} items.`;
};
export const WRONG_EVENT = (event) => {
return `${prefix} Expected a valid event name, instead received '${event}'.`;
};
export const NOT_OBJ_KEY = (key, shape) => {
return `${prefix} Key '${key}' doesn't exist on object but it was defined as required in shape. Valid keys: ["${Object.keys(shape).join('", "')}"].`;
};
export const WRONG_OBJ_VAL = (val, key, expected) => {
return `${prefix} Value of '${key}' doesn't match the defined in shape (${key}: ${expected}), instead received '${typeof val}'.`;
};
export const WRONG_OBJ_KEY = (key, shape) => {
return `${prefix} Key '${key}' doesn't exist on shape but it was defined in object. Valid keys: ["${Object.keys(shape).join('", "')}"].`;
};

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

import { errors } from '../errors/errors';
import { NOT_OBJ_KEY, WRONG_OBJ_KEY, WRONG_OBJ_VAL } from '../errors/errors';
export const compareObject = (test, shape) => {

@@ -7,3 +7,3 @@ const testKeys = Object.keys(test);

if (shape[key] === undefined) {
throw new Error(errors.WRONG_OBJ_KEY(key, shape));
throw new Error(WRONG_OBJ_KEY(key, shape));
}

@@ -13,3 +13,3 @@ });

if (test[key] === undefined) {
throw new Error(errors.NOT_OBJ_KEY(key, shape));
throw new Error(NOT_OBJ_KEY(key, shape));
}

@@ -19,3 +19,3 @@ });

if (!shape[key].val(test[key])) {
throw new Error(errors.WRONG_OBJ_VAL(test[key], key, shape[key].expected));
throw new Error(WRONG_OBJ_VAL(test[key], key, shape[key].expected));
}

@@ -22,0 +22,0 @@ });

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

export declare const errors: {
readonly NOT_STRING: (value: unknown, partial?: boolean) => string;
readonly NOT_BOOLEAN: (value: unknown, partial?: boolean) => string;
readonly NOT_ARRAY: (value: unknown, partial?: boolean) => string;
readonly NOT_OBJECT: (value: unknown, partial?: boolean) => string;
readonly NOT_FN: (value: unknown, partial?: boolean) => string;
readonly WRONG_LENGTH: (array: Array<unknown>, amount: number) => string;
readonly WRONG_EVENT: (event: string) => string;
readonly NOT_OBJ_KEY: (key: string, shape: object) => string;
readonly WRONG_OBJ_VAL: (val: unknown, key: string, expected: string) => string;
readonly WRONG_OBJ_KEY: (key: string, shape: object) => string;
};
export declare const NOT_STRING: (value: unknown, partial?: boolean) => string;
export declare const NOT_BOOLEAN: (value: unknown, partial?: boolean) => string;
export declare const NOT_ARRAY: (value: unknown, partial?: boolean) => string;
export declare const NOT_OBJECT: (value: unknown, partial?: boolean) => string;
export declare const NOT_FN: (value: unknown, partial?: boolean) => string;
export declare const WRONG_LENGTH: (array: Array<unknown>, amount: number) => string;
export declare const WRONG_EVENT: (event: string) => string;
export declare const NOT_OBJ_KEY: (key: string, shape: object) => string;
export declare const WRONG_OBJ_VAL: (val: unknown, key: string, expected: string) => string;
export declare const WRONG_OBJ_KEY: (key: string, shape: object) => string;
{
"name": "abortjs",
"version": "0.0.1",
"version": "0.0.2",
"scripts": {

@@ -13,3 +13,3 @@ "test": "cd tests/package-tests && npm i && cd ../.. && npx jest --watchAll",

"lint:fix": "npx eslint src --fix",
"publish": "git add . && git commit -m 'Publish package' && git push && npm run build && npm publish",
"publish": "git push && npm run build && npm publish",
"v:patch": "npm version patch",

@@ -28,3 +28,7 @@ "v:minor": "npm version minor",

},
"author": "brdevok",
"author": "brdevok <braianrosas1998@outlook.com> https://github.com/brdevok",
"repository": {
"type": "git",
"url": "https://github.com/brdevok/abortjs"
},
"description": "Small implementation of AbortController API for easy management of requests cancelation.",

@@ -36,3 +40,7 @@ "license": "MIT",

"browser",
"signal"
"signal",
"abortcontroller",
"request",
"promise",
"whatwg"
],

@@ -49,3 +57,6 @@ "devDependencies": {

"typescript": "^4.7.4"
},
"dependencies": {
"abort-controller": "^3.0.0"
}
}
# AbortJs :scissors:
Small implementation of AbortController API for easy management of requests cancelation in modern browsers, fully typed in Typescript.
Small implementation of AbortController API for easy management of requests cancelation, fully typed in Typescript.

@@ -14,3 +14,3 @@ * [What it does](#what-it-does)

AbortJs was created to facilitate the use of abort controllers in your code, it provides to the user a set of tools with a clean interface to easily manage the cancelation of requests withot relying in additional lines of code but with quick integration.
AbortJs was created to facilitate the use of abort controllers in your code, it provides to the user a set of tools with a clean interface to easily manage the cancelation of requests without relying in additional lines of code but with quick integration.

@@ -153,3 +153,3 @@ ## Quick start

* `event: string` - Name of the event.
* `callback: (event: { controller: string }) => void` = Callback to run when event fires.
* `callback: (event: { controller: string }) => void` - Callback to run when event fires.

@@ -162,5 +162,6 @@ Add an event handler for the defined event name. When fired, the callback will contain an object with the controller name that fired it.

* `event: string` - Name of the event.
* `callback: (event: { controller: string }) => void` = Function to be removed.
* `callback: (event: { controller: string }) => void` - Function to be removed.
Remove the event handler from the event scope defined in the name.
Remove the event handler from the event scope defined by name.
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc