import { Callback } from '@lib/Callback' ; export class Binding { private readonly _selector : string ; private readonly _callback : Callback ; private readonly _unbindCallback : ReturnType < Callback > ; public constructor ( selector , bindCallback , unbindCallback ) { this . _selector = selector ; this . _callback = bindCallback ; this . _unbindCallback = unbindCallback ; } public hasSameCallback ( callback ) { return this . _callback === callback ; } public match ( element ) { return element . matches ( this . _selector ) ; } public destroy ( element ) { if ( typeof this . _unbindCallback === 'function' ) { this . _unbindCallback ( element ) ; } } }