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

Add ability to dispatch browser events #138

Closed
grantcopley opened this issue Dec 28, 2023 · 1 comment
Closed

Add ability to dispatch browser events #138

grantcopley opened this issue Dec 28, 2023 · 1 comment
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@grantcopley
Copy link
Collaborator

https://laravel-livewire.com/docs/2.x/events#browser

@grantcopley grantcopley added the enhancement New feature or request label Dec 28, 2023
@grantcopley grantcopley added this to the 3.2 milestone Dec 28, 2023
@grantcopley grantcopley self-assigned this Dec 28, 2023
@grantcopley
Copy link
Collaborator Author

Incoming Livewire payload

{
    "fingerprint": {
        "id": "6YSX3bS3r5NReuwLu8uT",
        "name": "loader",
        "locale": "en",
        "path": "/",
        "method": "GET",
        "v": "acj"
    },
    "serverMemo": {
        "children": {
            "a": {
                "id": "rJh50BrdUMx51P0FF3ss",
                "tag": "div"
            }
        },
        "errors": [],
        "htmlHash": "af75abb6",
        "data": {
            "component": "component1",
            "toggle": true
        },
        "dataMeta": [],
        "checksum": "adfcbf840e10e3a2288a4111087b11741cce2c9fcd7f7e9adc45e225a80eec29"
    },
    "updates": [
        {
            "type": "callMethod",
            "payload": {
                "id": "nnlg",
                "method": "dispatchBE",
                "params": []
            }
        }
    ]
}

Outgoing CBWIRE payload

{
    "effects": {
        "html": "<div wire:id=\"6YSX3bS3r5NReuwLu8uT\">\n    <h1>Loader</h1>\n    1703736660\n    \n    <button wire:click=\"$refresh\">refresh</button>\n    <button wire:click=\"$set( 'toggle',  )\">$toggle</button>\n    <button wire:click=\"dispatchBE\">dispatch</button>\n\n            <div wire:id=\"rJh50BrdUMx51P0FF3ss\"></div>    \n</div>",
        "dispatches": [
            {
                "event": "name-updated",
                "data": {
                    "newName": "test"
                }
            }
        ],
        "dirty": []
    },
    "serverMemo": {
        "htmlHash": "f5900ebe",
        "checksum": "c40d8be540c3b0811827544b01ba3cf4519b924c4522bc0c01512b5a31a5e91a"
    }
}

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

No branches or pull requests

1 participant