Flarum likes a single page app, I need run a script when the discussion changed each time but I don’t know how to do it, thanks!
Here's the way add <script> tag to <head> but this script won't trigger when discussion changed
(new Extend\Frontend('forum'))
->content(function (Document $document) {
$document->head[] = '<script>alert("Hello, world!")</script>';
}),