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

use_script hook #894

Open
Archmonger opened this issue Jan 29, 2023 · 0 comments
Open

use_script hook #894

Archmonger opened this issue Jan 29, 2023 · 0 comments
Labels
priority-3-low May be resolved one any timeline. type-investigation About research and gathering information

Comments

@Archmonger
Copy link
Contributor

Archmonger commented Jan 29, 2023

Current Situation

Currently, there is no method to transmit the results of a JavaScript function to the backend.

Proposed Actions

Create a use_script hook that operates similarly to html.script, but can return a result.

For example,

@component
def example():
    script = use_script("getComputedStyle(document.querySelector('#element'))")
    return f"CSS Style Attributes: {script.data}"

Since this hook operates asynchronously, the interface should pretty much match our Django use_query hook.

See this comment for traceability.

As a note, it's going to be very important for us to pre-populated the this element with the current DOM node.

@Archmonger Archmonger added priority-3-low May be resolved one any timeline. type-investigation About research and gathering information labels Jan 29, 2023
@Archmonger Archmonger modified the milestones: Luxury Features, Luxury, Essential Jan 29, 2023
@rmorshea rmorshea removed this from the Essential milestone Feb 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority-3-low May be resolved one any timeline. type-investigation About research and gathering information
Projects
None yet
Development

No branches or pull requests

2 participants