MCPcopy Create free account
hub / github.com/NativeScript/NativeScript / PseudoClassHandler

Function PseudoClassHandler

packages/core/ui/core/view/view-common.ts:48–66  ·  view source on GitHub ↗
(...pseudoClasses: string[])

Source from the content-addressed store, hash-verified

46}
47
48export 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
68export const _rootModalViews = new Array<ViewBase>();
69

Callers 3

ButtonClass · 0.90
ButtonClass · 0.90

Calls 1

mapMethod · 0.65

Tested by

no test coverage detected