Behavior

Behavior

new Behavior(el, name) → {Behaviour}

Source:

Create a router

Example
import Behaviour from '@/core/Behaviour'

export default class ExampleWithAllTheThings Behaviour {
	mount = () => {
		// this.$el === the node with the data-behaviour
		this.$el.classList.add('mount')
		// this.$body === <body></body>
		// this.$html === <html></html>
		// this.KEY_CODES === common key codes
		// this.$data === any data attributes on this.$el
	}

	unmount = () => {}
}
Parameters:
Name Type Description
el HTMLElement

the html element to bind the behaviour too

name String

a name to give the behaviour

Returns:
Type
Behaviour

Methods

(static) destroy() → {void}

Source:

kill the current behaviour

Returns:
Type
void

(static) init() → {void}

Source:

initialise the router events

Returns:
Type
void

(static) mount() → {void}

Source:

called after instantiation

Returns:
Type
void

(static) unmount() → {void}

Source:

called when destroying

Returns:
Type
void