1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
use HashMap;
use ;
/// Custom JavaScript that bevy_cef evaluates in every webview.
///
/// Each extension's code runs in every frame's V8 context, in name order, after
/// `window.cef` is defined and before `PreloadScripts` and the page's own scripts.
/// Extensions apply to all webviews. Extension code can use `window.cef.emit()`,
/// `window.cef.listen()`, and `window.cef.brp()` to communicate with Bevy.
///
/// An exception or syntax error in one extension is reported to the page console, and the
/// remaining extensions and the page keep running.
///
/// # Example
///
/// ```no_run
/// use bevy_cef_core::prelude::*;
///
/// let extensions = CefExtensions::new()
/// .add("myGame", r#"
/// var myGame = {
/// sendScore: function(score) {
/// window.cef.emit({ score: score });
/// }
/// };
/// "#);
/// ```
;