Compare commits

...

2 commits

Author SHA1 Message Date
7e766a288b
Add typescript definitions file 2025-08-09 20:43:26 +02:00
59df45def7
Add package metadata 2025-08-09 20:43:23 +02:00
3 changed files with 68 additions and 0 deletions

7
jsconfig.json Normal file
View file

@ -0,0 +1,7 @@
{
"compilerOptions": {
"target": "esnext",
"allowJs": true,
"checkJs": true
}
}

13
package.json Normal file
View file

@ -0,0 +1,13 @@
{
"name": "controller-registry",
"exports": {
".": "./src/controller-registry.js"
},
"type": "module",
"license": "MIT",
"version": "0.0.1",
"url": "https://git.but.gay/darkwiiplayer/controller-registry",
"scripts": {
"definitions": "tsc src/*.js --declaration --allowJs --emitDeclarationOnly"
}
}

48
src/controller-registry.d.ts vendored Normal file
View file

@ -0,0 +1,48 @@
export class ControllerList {
/**
* @param {HTMLElement} element
* @param {String} attribute
* */
constructor(element: HTMLElement, attribute?: string);
/** @param {String} name */
contains(name: string): any;
/** @param {String} name */
add(name: string): void;
/** @param {String} name */
remove(name: string): void;
/**
* @param {String} name
* @param {String} replacement
*/
replace(name: string, replacement: string): boolean;
/**
* @param {String} name
* @param {Boolean} force
*/
toggle(name: string, force: boolean): void;
#private;
}
export class ControllerRegistry {
/** @typedef {HTMLElement} Root */
/**
* @param {Root} root
* @param {String} attribute
*/
constructor(root: HTMLElement, attribute?: string);
/**
* @param {Root} root
*/
upgrade(root: HTMLElement): void;
/**
* @param {String} name
* @param {Function} callback
*/
define(name: string, callback: Function): void;
get(name: any): any;
list(element: any): any;
getName(controller: any): void;
whenDefined(name: any): void;
#private;
}
declare const _default: ControllerRegistry;
export default _default;