(...pseudoClasses: string[])
| 46 | } |
| 47 | |
| 48 | export function PseudoClassHandler(...pseudoClasses: string[]): MethodDecorator { |
| 49 | const stateEventNames = pseudoClasses.map((s) => ':' + s); |
| 50 | |
| 51 | return <T>(target: Object, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => { |
| 52 | // This will help keep track of pseudo-class subscription changes |
| 53 | const subscribeKey = Symbol(propertyKey + '_flag'); |
| 54 | |
| 55 | function onSubscribe(subscribe: boolean) { |
| 56 | if (subscribe != !!this[subscribeKey]) { |
| 57 | this[subscribeKey] = subscribe; |
| 58 | this[propertyKey](subscribe); |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | for (const eventName of stateEventNames) { |
| 63 | target[eventName] = onSubscribe; |
| 64 | } |
| 65 | }; |
| 66 | } |
| 67 | |
| 68 | export const _rootModalViews = new Array<ViewBase>(); |
| 69 |
no test coverage detected