Skip to content
This repository has been archived by the owner on Feb 10, 2021. It is now read-only.

Lucia Bindings #2

Open
shadowtime2000 opened this issue Nov 13, 2020 · 2 comments
Open

Lucia Bindings #2

shadowtime2000 opened this issue Nov 13, 2020 · 2 comments
Labels
enhancement New feature or request

Comments

@shadowtime2000
Copy link
Contributor

shadowtime2000 commented Nov 13, 2020

It would be great to have simple bindings to connect this to Lucia. It would probably be really simple, just a wrapper around this:

atom.subscribe((newVal) => Lucia.use("app", newVal));
@shadowtime2000
Copy link
Contributor Author

I think it would be best to hold off on this until aidenybai/lucia#7 is finished to make sure we don't have to create any breaking changes once components are implemented.

@shadowtime2000
Copy link
Contributor Author

Maybe instead have the bind function convert an atom into an object that can be more easily read by Lucia for reactivity.

<div l-use="clickerGame">
	<p l-text="`$${store.val}`"></p>
	<button l-on:click="store.dispatch(store.val + 1)">Click!</button>
</div>
import { Atom } from "luciex";
import { bind } from "luciex-lucia";

const ClickStore = new Atom<number>(0);

Lucia.use("clickerGame", {
	store: bind(ClickStore)
});

@shadowtime2000 shadowtime2000 added the enhancement New feature or request label Nov 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant