MCPcopy Create free account
hub / github.com/cztomczak/cefpython / GlobalHandler

Class GlobalHandler

examples/tutorial.py:140–152  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

138
139
140class GlobalHandler(object):
141 def OnAfterCreated(self, browser, **_):
142 """Called after a new browser is created."""
143 # DOM is not yet loaded. Using js_print at this moment will
144 # throw an error: "Uncaught ReferenceError: js_print is not defined".
145 # We make this error on purpose. This error will be intercepted
146 # in DisplayHandler.OnConsoleMessage.
147 js_print(browser, "Python", "OnAfterCreated",
148 "This will probably never display as DOM is not yet loaded")
149 # Delay print by 0.5 sec, because js_print is not available yet
150 args = [browser, "Python", "OnAfterCreated",
151 "(Delayed) Browser id="+str(browser.GetIdentifier())]
152 threading.Timer(0.5, js_print, args).start()
153
154
155class LoadHandler(object):

Callers 1

set_global_handlerFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected