mirror of
https://gitee.com/ant-design-blazor/ant-design-blazor.git
synced 2024-12-14 08:51:27 +08:00
29e3ce3583
* fix(module:interop): reorganization into classes * comments clean-up * Add typescript test project * fix: sync with pull request #1765: support drag * github test action fix attempt * tests: jsinterop test mock fix * codecov added to ts tests * add generated split js to gitignore * fix: coverage github action Co-authored-by: James Yeung <shunjiey@hotmail.com>
32 lines
881 B
TypeScript
32 lines
881 B
TypeScript
import { eventCallback } from './dom/types'
|
|
|
|
//Singleton
|
|
export class State {
|
|
private static instance: State;
|
|
|
|
//Stores references to dot net objects (components wrapped in DotNetObjectReference)
|
|
objReferenceDict: { [key: string]: any } = {};
|
|
|
|
//All object references must later be disposed by JS code or by .NET code.
|
|
disposeObj(objReferenceName) {
|
|
delete this.objReferenceDict[objReferenceName];
|
|
}
|
|
|
|
//Stores callback for events based on a key. Needed when
|
|
//Event needs to be removed - the callback can be retrieved and
|
|
//used to remove the event in question
|
|
eventCallbackRegistry: { [key: string]: eventCallback} = {};
|
|
|
|
oldBodyCacheStack = [];
|
|
|
|
private constructor() { }
|
|
|
|
static getInstance() {
|
|
if (!this.instance) {
|
|
this.instance = new State();
|
|
}
|
|
return this.instance;
|
|
}
|
|
}
|
|
|
|
export const state = State.getInstance(); |