Compare commits
2 commits
e52bfd8e13
...
7e766a288b
Author | SHA1 | Date | |
---|---|---|---|
7e766a288b | |||
59df45def7 |
3 changed files with 68 additions and 0 deletions
7
jsconfig.json
Normal file
7
jsconfig.json
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "esnext",
|
||||||
|
"allowJs": true,
|
||||||
|
"checkJs": true
|
||||||
|
}
|
||||||
|
}
|
13
package.json
Normal file
13
package.json
Normal 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
48
src/controller-registry.d.ts
vendored
Normal 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;
|
Loading…
Reference in a new issue