-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
Type script
- Loading branch information
There are no files selected for viewing
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
export default class TestAsyncComponent extends DcBaseComponent { | ||
onInit() { | ||
export class TestAsyncComponent extends DcBaseComponent { | ||
static namespace = 'test-async-component'; | ||
|
||
init() { | ||
this.element.innerHTML = 'Test async component was initialized'; | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** | ||
* This function returns wrapper componentClass | ||
* | ||
* @param {function} importFunction | ||
* @return {typeof DcBaseComponent} wrapper for component class | ||
*/ | ||
export declare const dcAsync: (importFunction: CallableFunction) => any; | ||
//# sourceMappingURL=dc-async.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { ReferencesCollection } from './dc-dom'; | ||
/** | ||
* Base component. | ||
* @class | ||
* @implements {DcBaseComponent} | ||
*/ | ||
declare class DcBaseComponent { | ||
readonly element: HTMLElement; | ||
private _listenersList; | ||
protected readonly options: object; | ||
protected readonly refs: ReferencesCollection; | ||
static namespace: string; | ||
static requiredRefs: string[]; | ||
constructor(element: HTMLElement, namespace: string, requiredRefs: string[]); | ||
private _checkRequiredRefs; | ||
init(): void; | ||
protected readonly addListener: (elem: HTMLElement, eventName: string, eventCallback: CallableFunction) => void; | ||
private _removeAllListeners; | ||
readonly destroy: () => void; | ||
protected onDestroy(): void; | ||
} | ||
export { DcBaseComponent }; | ||
//# sourceMappingURL=dc-base-component.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
declare const matches: (root: HTMLElement, selector: string) => boolean; | ||
/** | ||
* | ||
* @param {HTMLElement} element | ||
* @param {string} selector | ||
* @return {HTMLElement[]} | ||
*/ | ||
declare const scopedQuerySelectorAll: (element: HTMLElement, selector: string) => HTMLElement[]; | ||
/** | ||
* @param {HTMLElement} root! | ||
* @param {string} namespace | ||
* @param {?string|Function} selector | ||
* @return {Array} | ||
* @throws Error | ||
*/ | ||
declare const findElementsForInit: (root: HTMLElement, namespace: string, selector?: string | Function | undefined) => HTMLElement[]; | ||
/** | ||
* @param {HTMLElement} element | ||
* @return {boolean} | ||
*/ | ||
declare const isElementWithinLazyParent: (element: HTMLElement) => boolean; | ||
/** | ||
* @param {HTMLElement} element | ||
* @param {string} namespace | ||
* @return {ReferencesCollection} | ||
*/ | ||
interface ReferencesCollection { | ||
[key: string]: HTMLElement | HTMLElement[] | { | ||
[_key: string]: HTMLElement; | ||
}; | ||
} | ||
declare const getElementRefs: (element: HTMLElement, namespace: string) => ReferencesCollection; | ||
/** | ||
* @param {HTMLElement} element | ||
* @param {string} namespace | ||
* @return {?Object} | ||
*/ | ||
declare const getElementOptions: (element: HTMLElement, namespace: string) => {}; | ||
export { ReferencesCollection, scopedQuerySelectorAll, getElementRefs, findElementsForInit, isElementWithinLazyParent, matches, getElementOptions, }; | ||
//# sourceMappingURL=dc-dom.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { DcBaseComponent } from 'src/dc-base-component'; | ||
declare class DcFactory { | ||
private _registeredComponents; | ||
/** | ||
* | ||
* @param {typeof DcBaseComponent} ComponentClass | ||
* @param {Function|string} selector that indicates how we should search that component elements | ||
*/ | ||
register(ComponentClass: typeof DcBaseComponent, selector?: string | Function | undefined): void; | ||
/** | ||
* Starts the factory on a given root: finds and creates all registered components within the root | ||
* @param {HTMLElement} root | ||
* @param {boolean} withLazy - Whether or not initialize component which is marked as lazy | ||
*/ | ||
init: (root?: HTMLElement, withLazy?: boolean) => void; | ||
/** | ||
* Destroy all previously registered components within the passed element | ||
* @param {HTMLElement} root | ||
*/ | ||
destroy: (root: HTMLElement) => void; | ||
private _getComponent; | ||
private _getState; | ||
private _setState; | ||
private _initComponent; | ||
private _initComponentOnElement; | ||
private _createComponent; | ||
} | ||
export declare const dcFactory: DcFactory; | ||
export {}; | ||
//# sourceMappingURL=dc-factory.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.