-
-
Notifications
You must be signed in to change notification settings - Fork 331
Open
Labels
priority-3-lowMay be resolved one any timeline.May be resolved one any timeline.type-investigationAbout research and gathering informationAbout research and gathering information
Description
Current Situation
Currently, there is no method to transmit the results of a JavaScript function to the backend.
Proposed Actions
This might look like a use_script hook that operates similarly to html.script, but can return a result.
For example,
@component
def example():
executor = use_script("getComputedStyle(document.querySelector('#element'))")
return f"CSS Style Attributes: {executor.data}"Since this hook would need to operate asynchronously, the interface would likely be heavily inspired by our Django use_query hook.
And perhaps it could be used as an executor within event contexts to be more "reactive":
@component
def example():
executor = use_script("getComputedStyle(document.querySelector('#element'))", deferred=True)
async def on_click(event):
await executor()
example_value = executor.data
return f"CSS Style Attributes: {script.data}"See this comment for traceability.
Note: If possible, we should try pre-populate this keyword with something that makes sense, depending on where the JavaScript was executed.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
priority-3-lowMay be resolved one any timeline.May be resolved one any timeline.type-investigationAbout research and gathering informationAbout research and gathering information