Other Methods - alexeyp0708/js-interfaces GitHub Wiki
End Points
These are the classes on which the analysis and search of interfaces in the prototype chain ends. Interface rules are generated throughout the Class prototype chain. To stop further analysis on a specific prototype, you must specify the appropriate point. Such classes may be system classes. For example Audio or Node. There are global endpoints (apply to all classes) and there are local endpoints (installed for each class separately)
Global end points
Setting global end points is done before declaring the first Interface.
InterfaceManager.addGlobalEndPoints([
MyPointClass,
MyPointClass2,
]);
Local end points
Set after the class declaration, but before the declaration of the generation of interface rules.
class MyInterface extends OldClass { }
MyInterface.isInterface=true;
class NewClass extends MyInterface {
}
InterfaceManager.setEndPoints(NewClass,[OldClass]);
InterfaceManager.extendInterfaces(NewClass);
Freeze existing class properties
Freezes the class’s own properties. The class will be extensible with other properties. But changing or deleting existing ones will be impossible. It is necessary to freeze after generating the rules of the interface.
class MyInterface {}
MyInterface.isInterface=true;
class MyClass{}
InterfaceManager.implementInterfaces(MyClass,MyInterface);
InterfaceManager.freezePropСlass(MyClass);