File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -267,7 +267,7 @@ Subscribing to updates in JavaScript from a Twig template is straightforward:
267
267
<script>
268
268
269
269
The ``mercure() `` Twig function will generate the URL of the Mercure hub according to the configuration.
270
- The URL will include the ``topic `` query parameters corresponding to to thee topics passed as first argument.
270
+ The URL will include the ``topic `` query parameters corresponding to the topics passed as first argument.
271
271
272
272
If you want to access to this URL from an external JavaScript file, generate the URL in a dedicated HTML element:
273
273
@@ -291,13 +291,12 @@ as patterns:
291
291
292
292
<script>
293
293
{# Subscribe to updates of several Book resources and to all Review resources matching the given pattern #}
294
- const eventSource = new EventSource("{{ mercure(
295
- [
296
- 'https://example.com/books/1',
297
- 'https://example.com/books/2',
298
- 'https://example.com/reviews/{id}'
299
- ]
300
- )|escape('js') }}");
294
+ const eventSource = new EventSource("{{ mercure([
295
+ 'https://example.com/books/1',
296
+ 'https://example.com/books/2',
297
+ 'https://example.com/reviews/{id}'
298
+ ])|escape('js') }}");
299
+
301
300
eventSource.onmessage = event => {
302
301
console.log(JSON.parse(event.data));
303
302
}
You can’t perform that action at this time.
0 commit comments