Skip to content
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

JavaScript Context Docs / Examples #1327

Open
chahu opened this issue Apr 15, 2024 · 1 comment
Open

JavaScript Context Docs / Examples #1327

chahu opened this issue Apr 15, 2024 · 1 comment

Comments

@chahu
Copy link

chahu commented Apr 15, 2024

I couldn't find any docs/examples of using lit context with modern JavaScript. All the docs are Typescript. Where can I find JavaScript examples? Thanks.

https://lit.dev/docs/data/context/

@augustjk
Copy link
Member

Check out https://lit.dev/playground/#sample=examples/context-basics and toggle the language to JS for a running example.

We haven't gotten around to adding any switchable code samples for those docs but it shouldn't be too difficult to use any of the code there in vanilla JavaScript by removing any type annotations or class member keywords like private.

While decorators can work in JavaScript (they are stage 3 proposal to the language), it will currently require transpilation with something like babel as it's not yet implemented in any JS runtime/browsers.

You can use any of the controllers without transpilation though. e.g. https://lit.dev/docs/data/context/#contextprovider

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

2 participants