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

Streamline data and state management #611

Open
domq opened this issue Nov 4, 2022 · 1 comment
Open

Streamline data and state management #611

domq opened this issue Nov 4, 2022 · 1 comment

Comments

@domq
Copy link
Member

domq commented Nov 4, 2022

Like every program of some size, the JavaScript code in epfl-elements takes a number of parameters and manages state.

Right now, the following flavors of parameters and state are used:

We might want to provide uniformity here.

@domq
Copy link
Member Author

domq commented Nov 4, 2022

Since the data-foo use cases enable declarative (JavaScript-free) use-cases, and they are parameters (inbound) only, they should probably stay the way they are.

Since we already have a $.fn.epflElements, this sounds like as good a place as any to start. We propose to make the following getters / setters work:

const svgPath = $('body').epflElements("svgPath");
$('body').epflElements("svgPath", "/icons/foo.svg");

const consented = $('body').epflElements("cookieConsent");
$('body').epflElements("cookieConsent", "notRequired");

The latter would address #610.

In addition to (or instead of) that, we could turn window.svgPath, window.featherSvgPath and window.cookieconsent into data-epfl-elements-icons-uri, data-epfl-elements-feather-icons-uri and data-epfl-cookieconsent attributes of the <body> tag, respectively.

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

No branches or pull requests

1 participant