-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is it possible to use [target.static]
without TS?
#300
Comments
It should be possible. If it doesn't work it may be a bug. I will add a test shortly. |
@keithamus turns out with my babel configs which include |
Thanks for replying back @omohokcoj! Glad you got this solved 🙌 |
@keithamus btw looks like the issue was not with my babel setup but just in general for JS in browser without any transpiler <!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<script type="importmap">
{
"imports": {
"@github/catalyst": "https://ga.jspm.io/npm:@github/[email protected]/lib/index.js"
}
}
</script>
<script async src="https://ga.jspm.io/npm:[email protected]/dist/es-module-shims.js" crossorigin="anonymous"></script>
<script type="module">
import { controller, target } from "@github/catalyst";
controller(class TestElem extends HTMLElement {
static [target.static] = ['test'] // static keyword is required
connectedCallback () {
console.log(this.test)
}
})
</script>
<test-elem>
<div data-target="test-elem.test">
</div>
</test-elem>
</body>
</html> Anyway, thanks for maintaining such a useful library - github/catalyst with native web components looks much better for rails app than hotwire/stimulus 😄 |
Thanks! I've fixed the docs in 173a241 |
I'm following the v2 documentation (https://catalyst.rocks/guide-v2/targets) but the following code snippet doesn't work with JS:
Is this possible to use this feature in JS or it works only via TS?
The text was updated successfully, but these errors were encountered: