great-gold-37694
02/07/2023, 10:43 PMgreat-gold-37694
02/07/2023, 11:52 PMthankful-addition-60522
02/08/2023, 8:36 AMstocky-dentist-80693
02/08/2023, 9:25 AMimport 'htmx.org/dist/htmx.js';
const htmx = window.htmx;
thankful-addition-60522
02/08/2023, 9:45 AMhtmx
var goes?thankful-addition-60522
02/08/2023, 9:45 AMstocky-dentist-80693
02/08/2023, 9:48 AMimport htmx from 'htmx.org/dist/htmx.js
, and reference that var, but it didn't work.thankful-addition-60522
02/08/2023, 10:00 AMgorgeous-ocean-41861
02/08/2023, 10:39 AMwsConfigSend
event in the ws extension (use case: to encrypt a message before it’s sent to the server for end-to-end encryption). It looks like the handler is called but not awaited. I tried awaiting the function in the handler declaration but that didn’t work. I then tried preventing the default event and using the event.detail.socketWrapper
to manually send the message but it doesn’t even look like that’s being triggered. (From my tests, it looks like the handler is being garbage collected very soon after it’s run, even before it hits an await statement inside it.)
(I’m using Alpine.js to add the handler.)
Any ideas?
html
<div
id='chat'
hx-ext='ws'
ws-connect='/chat.socket'
x-data='{ showPlaceholder: true }'
@htmx:ws-config-send='encryptMessage'
>
…
</div>
js
async function encryptMessage (event) {
const parameters = event.detail.parameters
const ourPrivateKey = localStorage.getItem('secret')
const encryptedMessage = await encryptMessageForDomain(parameters.text, ourPrivateKey, parameters.domain)
event.detail.parameters['text'] = encryptedMessage
}
ripe-action-67367
02/08/2023, 10:54 AMgorgeous-ocean-41861
02/08/2023, 11:00 AMripe-action-67367
02/08/2023, 11:00 AMgorgeous-ocean-41861
02/08/2023, 11:01 AMripe-action-67367
02/08/2023, 11:01 AMripe-action-67367
02/08/2023, 11:02 AMgorgeous-ocean-41861
02/08/2023, 11:09 AMgorgeous-ocean-41861
02/08/2023, 11:11 AMripe-action-67367
02/08/2023, 11:12 AMripe-action-67367
02/08/2023, 11:16 AMgorgeous-ocean-41861
02/08/2023, 11:22 AMripe-action-67367
02/08/2023, 11:27 AMgorgeous-ocean-41861
02/08/2023, 2:21 PMgorgeous-ocean-41861
02/08/2023, 2:36 PMgorgeous-ocean-41861
02/08/2023, 3:00 PMengines
declarations had no effect so I didn’t include it but at least documented the Python 2 requirement in a PR.)gorgeous-ocean-41861
02/08/2023, 3:06 PMsocketWrapper
methods or would you rather I left it to you?ripe-action-67367
02/08/2023, 3:08 PMgorgeous-ocean-41861
02/08/2023, 3:08 PMripe-action-67367
02/08/2023, 3:59 PMgorgeous-ocean-41861
02/08/2023, 4:05 PMgorgeous-ocean-41861
02/08/2023, 4:34 PM