|
3 | 3 |
|
4 | 4 | # LifespanHandler (interface)
|
5 | 5 |
|
6 |
| -Implement this interface to handle events related to browser life span. The methods of this class will be called on the UI thread. |
| 6 | +Implement this interface to handle events related to browser life span. |
| 7 | +The methods of this class will be called on the UI thread. |
7 | 8 |
|
8 |
| -For an example of how to implement a handler see [cefpython](cefpython.md).CreateBrowser(). For a list of all handler interfaces see [API > Client handlers](API#Client_handlers). |
| 9 | +Related code snippets: |
| 10 | +- [onbeforeclose.py](../examples/snippets/onbeforeclose.py) |
9 | 11 |
|
10 | 12 |
|
11 | 13 | Table of contents:
|
12 | 14 | * [Callbacks](#callbacks)
|
13 |
| - * [OnBeforePopup](#onbeforepopup) |
14 |
| - * [_OnAfterCreated](#_onaftercreated) |
15 | 15 | * [DoClose](#doclose)
|
| 16 | + * [_OnAfterCreated](#_onaftercreated) |
16 | 17 | * [OnBeforeClose](#onbeforeclose)
|
| 18 | + * [OnBeforePopup](#onbeforepopup) |
17 | 19 |
|
18 | 20 |
|
19 | 21 | ## Callbacks
|
20 | 22 |
|
21 | 23 |
|
| 24 | +### DoClose |
| 25 | + |
| 26 | +| Parameter | Type | |
| 27 | +| --- | --- | |
| 28 | +| browser | [Browser](Browser.md) | |
| 29 | +| __Return__ | bool | |
| 30 | + |
| 31 | +Called when a browser has recieved a request to close. This may result |
| 32 | +directly from a call to [Browser](Browser.md).`CloseBrowser` or indirectly |
| 33 | +if the |
| 34 | +browser is a top-level OS window created by CEF and the user attempts to |
| 35 | +close the window. This method will be called after the Javascript |
| 36 | +'onunload' event has been fired. It will not be called for browsers after |
| 37 | +the associated OS window has been destroyed (for those browsers it is no |
| 38 | +longer possible to cancel the close). |
| 39 | + |
| 40 | +See complete description of this callback in [cef_life_span_handler.h] |
| 41 | +(..|src|include|cef_life_span_handler.h). |
| 42 | + |
| 43 | + |
| 44 | +### _OnAfterCreated |
| 45 | + |
| 46 | +| Parameter | Type | |
| 47 | +| --- | --- | |
| 48 | +| browser | [Browser](Browser.md) | |
| 49 | +| __Return__ | void | |
| 50 | + |
| 51 | +Called after a new browser is created. This callback will be the first |
| 52 | +notification that references |browser|. |
| 53 | + |
| 54 | +This callback will be executed during browser creation, thus you must call [cefpython](cefpython.md).SetGlobalClientCallback() to use it. The callback name was prefixed with "`_`" to distinguish this special behavior. |
| 55 | + |
| 56 | + |
| 57 | +### OnBeforeClose |
| 58 | + |
| 59 | +| Parameter | Type | |
| 60 | +| --- | --- | |
| 61 | +| browser | [Browser](Browser.md) | |
| 62 | +| __Return__ | void | |
| 63 | + |
| 64 | +Called just before a browser is destroyed. Release all references to the |
| 65 | +browser object and do not attempt to execute any methods on the browser |
| 66 | +object after this callback returns. This callback will be the last |
| 67 | +notification that references |browser|. See DoClose() documentation for |
| 68 | +additional usage information. |
| 69 | + |
| 70 | + |
22 | 71 | ### OnBeforePopup
|
23 | 72 |
|
24 | 73 | | Parameter | Type |
|
@@ -73,50 +122,3 @@ There will be no "window.opener" property available in the popup window.
|
73 | 122 | * WOD_SAVE_TO_DISK,
|
74 | 123 | * WOD_OFF_THE_RECORD,
|
75 | 124 | * WOD_IGNORE_ACTION
|
76 |
| - |
77 |
| - |
78 |
| -### _OnAfterCreated |
79 |
| - |
80 |
| -| Parameter | Type | |
81 |
| -| --- | --- | |
82 |
| -| browser | [Browser](Browser.md) | |
83 |
| -| __Return__ | void | |
84 |
| - |
85 |
| -Called after a new browser is created. This callback will be the first |
86 |
| -notification that references |browser|. |
87 |
| - |
88 |
| -This callback will be executed during browser creation, thus you must call [cefpython](cefpython.md).SetGlobalClientCallback() to use it. The callback name was prefixed with "`_`" to distinguish this special behavior. |
89 |
| - |
90 |
| - |
91 |
| -### DoClose |
92 |
| - |
93 |
| -| Parameter | Type | |
94 |
| -| --- | --- | |
95 |
| -| browser | [Browser](Browser.md) | |
96 |
| -| __Return__ | bool | |
97 |
| - |
98 |
| -Called when a browser has recieved a request to close. This may result |
99 |
| -directly from a call to [Browser](Browser.md).`CloseBrowser` or indirectly |
100 |
| -if the |
101 |
| -browser is a top-level OS window created by CEF and the user attempts to |
102 |
| -close the window. This method will be called after the Javascript |
103 |
| -'onunload' event has been fired. It will not be called for browsers after |
104 |
| -the associated OS window has been destroyed (for those browsers it is no |
105 |
| -longer possible to cancel the close). |
106 |
| - |
107 |
| -See complete description of this callback in [cef_life_span_handler.h] |
108 |
| -(..|src|include|cef_life_span_handler.h). |
109 |
| - |
110 |
| - |
111 |
| -### OnBeforeClose |
112 |
| - |
113 |
| -| Parameter | Type | |
114 |
| -| --- | --- | |
115 |
| -| browser | [Browser](Browser.md) | |
116 |
| -| __Return__ | void | |
117 |
| - |
118 |
| -Called just before a browser is destroyed. Release all references to the |
119 |
| -browser object and do not attempt to execute any methods on the browser |
120 |
| -object after this callback returns. This callback will be the last |
121 |
| -notification that references |browser|. See DoClose() documentation for |
122 |
| -additional usage information. |
|
0 commit comments