def __init__(self, console): self.console = console def log(msg): print msg js_print_m(console, msg) self.console.log = log CommonJS.__init__(self)
if(not lib_path in sys.path): sys.path.append(os.path.join(MODULE_PATH, lib_path)) sys.path.append(MODULE_PATH) cross_platform(); try: import PyV8 except Exception, e: raise Exception, ''' Sorry, the v8 engine are not built correctlly. Maybe you need to build v8 follow the guide of lib/PyV8/README.md. ''' from jscontext.commonjs import CommonJS CommonJS.append(MODULE_PATH) def package_file(filename): return os.path.join(MODULE_PATH, filename) JSCONSOLE_VIEW_NAME = 'jsconsole_view' class JsConsoleCommand(sublime_plugin.WindowCommand): def __init__(self, window): self.console = window.get_output_panel(JSCONSOLE_VIEW_NAME) self.console.set_name(JSCONSOLE_VIEW_NAME) self.window = window version = sublime.load_settings('package-metadata.json').get('version') or 'dev' js_print_m(self.console, "#JavaScript Console (build:" + version + ")") JsConsoleCommand.core = JSCore(self.console) def run(self): if(not 'history' in dir(JsConsoleCommand)):
sys.path.append(os.path.join(MODULE_PATH, lib_path)) sys.path.append(MODULE_PATH) cross_platform() try: import PyV8 except Exception, e: raise Exception, ''' Sorry, the v8 engine are not built correctlly. Maybe you need to build v8 follow the guide of lib/PyV8/README.md. ''' from jscontext.commonjs import CommonJS CommonJS.append(MODULE_PATH) def package_file(filename): return os.path.join(MODULE_PATH, filename) JSCONSOLE_VIEW_NAME = 'jsconsole_view' class JsConsoleCommand(sublime_plugin.WindowCommand): def __init__(self, window): self.console = window.get_output_panel(JSCONSOLE_VIEW_NAME) self.console.set_name(JSCONSOLE_VIEW_NAME) self.window = window version = sublime.load_settings('package-metadata.json').get(