import { A_Frame } from "@adaas/a-frame/core" import { AreDeclaration, AreMutation, AreInstructionSerialized } from "@adaas/are"; import { AreHtmlAddListenerInstructionPayload } from "./AreHTML.instructions.types"; import { AreHTMLInstructions } from "./AreHTML.instructions.constants"; @A_Frame.Define({ namespace: 'a-are-html', description: 'Attaches a DOM event listener to an element. Apply calls addEventListener; revert calls removeEventListener.' }) export class AddListenerInstruction extends AreMutation { constructor( parent: AreDeclaration, props: AreHtmlAddListenerInstructionPayload | AreInstructionSerialized ) { if ('aseid' in props) { super(props as AreInstructionSerialized); } else { super(AreHTMLInstructions.AddListener, parent, props); } } }