Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
el.id = name
el.innerHTML = code
window.flexx.asset_node.appendChild(el)
elif kind == 'CSS':
el = window.document.createElement("style")
el.type = "text/css"
el.id = name
el.innerHTML = code
window.flexx.asset_node.appendChild(el)
else:
window.console.error('Dont know how to DEFINE ' +
name + ' with "' + kind + '".')
elif cmd == 'OPEN':
window.win1 = window.open(command[1], 'new', 'chrome')
else:
window.console.error('Invalid command: "' + cmd + '"')
return command
def on_ws_error(self, evt):
self._ws = None
self.status = 0
window.console.error('Socket error')
session.send_command("INFO", str(msg))
def warn(msg):
window.console.ori_warn(msg)
for session in self.sessions.values():
session.send_command("WARN", str(msg))
def error(msg):
evt = dict(message=str(msg), error=msg, preventDefault=lambda: None)
on_error(evt)
def on_error(evt):
self._handle_error(evt)
on_error = on_error.bind(self)
# Set new versions
window.console.log = log
window.console.info = info
window.console.warn = warn
window.console.error = error
# Create error handler, so that JS errors get into Python
window.addEventListener('error', on_error, False)
# With this method, sourceURL does not work on Firefox,
# but eval might not work for assets that don't "use strict"
# (e.g. Bokeh). Note, btw, that creating links to assets does
# not work because these won't be loaded on time.
el = window.document.createElement("script")
el.id = name
el.innerHTML = code
window.flexx.asset_node.appendChild(el)
elif kind == 'CSS':
el = window.document.createElement("style")
el.type = "text/css"
el.id = name
el.innerHTML = code
window.flexx.asset_node.appendChild(el)
else:
window.console.error('Dont know how to DEFINE ' +
name + ' with "' + kind + '".')
elif cmd == 'OPEN':
window.win1 = window.open(command[1], 'new', 'chrome')
else:
window.console.error('Invalid command: "' + cmd + '"')
return command