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

IDEA: scroll parser which uses javascript template literals #158

Open
btheado opened this issue Jan 15, 2025 · 2 comments
Open

IDEA: scroll parser which uses javascript template literals #158

btheado opened this issue Jan 15, 2025 · 2 comments

Comments

@btheado
Copy link
Contributor

btheado commented Jan 15, 2025

This is somewhat related to the particleExplorer discussion in #154, except instead here javascript template literals are used

displayBelowParticle
  templateLiteral
    <ul>
     <li>${this.get("field1")}</li>
     <li>${this.get("field2")}</li>
    </ul>
  templateLiteral scroll
    ul
     li ${this.get("field1")}
     li ${this.get("field2")}
someParticle
 field1 value1
 field2 value2

The subparticles of templateLiteral (without an atom following the cue) will be expanded as a normal javascript template literal. If the first atom is scroll, then it will be called using the tagged functon scroll (i.e. scroll`<subparticles here>` ). The scroll tagged function will convert to html, I guess.

In either case, some variable (like this) above will be set to allow access to the selected particle.

@btheado
Copy link
Contributor Author

btheado commented Jan 15, 2025

After looking how template literals work in javascript, this idea doesn't seem so appealing anymore. I thought under-the-hood there was some javascript function which can perform whatever substitution the javascript parser performs. But that is not the case and therefore using template literals is likely no better than using eval on a javascript string.

@breck7
Copy link
Owner

breck7 commented Jan 16, 2025

Thanks for following up! I think it's interesting to think out loud about this kind of stuff. Perhaps we should start doing Scroll conferences.

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

2 participants