How to use the pscript.stubs.window.console.info function in pscript

To help you get started, we’ve selected a few pscript examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github flexxui / flexx / flexx / app / _clientcore.py View on Github external
def init_logging(self):
        """ Setup logging so that messages are proxied to Python.
        """
        if window.console.ori_log:
            return  # already initialized the loggers
        # Keep originals
        window.console.ori_log = window.console.log
        window.console.ori_info = window.console.info or window.console.log
        window.console.ori_warn = window.console.warn or window.console.log
        window.console.ori_error = window.console.error or window.console.log

        def log(msg):
            window.console.ori_log(msg)
            for session in self.sessions.values():
                session.send_command("PRINT", str(msg))
        def info(msg):
            window.console.ori_info(msg)
            for session in self.sessions.values():
                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):
github flexxui / flexx / flexx / app / _clientcore.py View on Github external
window.console.ori_info(msg)
            for session in self.sessions.values():
                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)
github flexxui / flexx / flexx / app / _clientcore.py View on Github external
def on_ws_close(evt):
            self._ws = None
            self.status = 0
            msg = 'Lost connection with server'
            if evt and evt.reason:
                msg += ': %s (%i)' % (evt.reason, evt.code)
            if not window.flexx.is_notebook:
                # todo: show modal or cooky-like dialog instead of killing whole page
                window.document.body.textContent = msg
            else:
                window.console.info(msg)
        def on_ws_error(self, evt):
github flexxui / flexx / flexx / app / _clientcore.py View on Github external
def on_ws_open(evt):
            window.console.info('Socket opened with session id ' + self.id)
            self.send_command('HI_FLEXX', self.id)
        def on_ws_message(evt):