Skip to content

Commit ea8847e

Browse files
committed
use targetable in controller
1 parent ca1f938 commit ea8847e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/controller.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
import {CatalystDelegate} from './core.js'
21
import type {CustomElementClass} from './custom-element.js'
2+
import {targetable} from './targetable.js'
33
import {attrable} from './attrable.js'
44
import {actionable} from './actionable.js'
5+
import {register} from './register.js'
56

67
/**
78
* Controller is a decorator to be used over a class that extends HTMLElement.
89
* It will automatically `register()` the component in the customElement
910
* registry, as well as ensuring `bind(this)` is called on `connectedCallback`,
1011
* wrapping the classes `connectedCallback` method if needed.
1112
*/
12-
export function controller(classObject: CustomElementClass): void {
13-
new CatalystDelegate(actionable(attrable(classObject)))
13+
export function controller<T extends CustomElementClass>(Class: T) {
14+
return register(actionable(attrable(targetable(Class))))
1415
}

0 commit comments

Comments
 (0)