transcrypt

How can I make JavaScript modules work in IE 11

梦想与她 提交于 2021-01-27 23:39:49
问题 I have JavaScript modules which I want to use with IE11. In the HTML pages they are referenced like this: <script type="module"> import * as mystuff from './scripts/mystuff.js'; window.mystuff = mystuff </script> They do not work in Internet Explorer 11, but I cannot change the modules to normal scripts (because they are generated by Transcrypt). How can I make them work with IE? Does a polyfill or something similar for the <script type="module"> construct exist? 回答1: You cannot do this. IE

Opy 1.1.28 python代码混淆

好久不见. 提交于 2020-05-05 15:47:07
Opy will obfuscate your extensive, real world, multi module Python source code for free! And YOU choose per project what to obfuscate and what not, by editing the config file: You can recursively exclude all identifiers of certain modules from obfuscation. You can exclude human readable configuration files containing Python code. You can use getattr, setattr, exec and eval by excluding the identifiers they use. You can even obfuscate module file names and string literals. You can run your obfuscated code from any platform. Bugs fixed: utf-8 forced for setup (issue 25) pep8_comments config

Transcrypt and FileReader

点点圈 提交于 2019-12-24 01:56:13
问题 I am trying to load a local image file into the browser. The code doesn't work. It always returns null for the result of the Filereader. The code for read_file3.py : #!/usr/bin/env python # -*- coding: utf-8 -*- class TestSystem: def openFile(self, event): self.inputvar = event.target console.log("self.inputvar"+self.inputvar) console.log("self.inputvar.files[0]"+self.inputvar.files[0]) self.freader = __new__(FileReader()) self.freader.onload = self.processInput() self.freader.readAsDataURL

Using promises with Transcrypt

大城市里の小女人 提交于 2019-12-22 18:35:12
问题 I'm having great fun with Transcrypt, a fantastic Python 3 to Javascript compiler available as a python module. Most of my code is synchronous, but i've had no problem doing things with setTimeout and XHR requests. Now i've started using PouchDB for local persistence and am trying to find a pretty way to handle promises. At the moment, I am doing this to write to a pouchdb instance: def db_put(): def put_success(doc): print("Put a record in the db. Id: ", doc.id, "rev: ", doc.rev) def put

Best way to integrate Python and JavaScript?

微笑、不失礼 提交于 2019-12-17 05:37:55
问题 Is it possible to integrate Python and JavaScript? For example, imagine you wanted to be able to define classes in JavaScript and use them from Python (or vice versa). If so, what's the best way? I'm interested not only if this is possible but if anyone has done it within a "serious" project or product . I'm guessing it would be possible using Jython and Rhino, for one example, but I'm curious whether or not anyone's ever actually done this, and if there are solutions for other platforms

Best way to integrate Python and JavaScript?

让人想犯罪 __ 提交于 2019-12-17 05:37:15
问题 Is it possible to integrate Python and JavaScript? For example, imagine you wanted to be able to define classes in JavaScript and use them from Python (or vice versa). If so, what's the best way? I'm interested not only if this is possible but if anyone has done it within a "serious" project or product . I'm guessing it would be possible using Jython and Rhino, for one example, but I'm curious whether or not anyone's ever actually done this, and if there are solutions for other platforms

Using promises with Transcrypt

混江龙づ霸主 提交于 2019-12-06 09:51:15
I'm having great fun with Transcrypt , a fantastic Python 3 to Javascript compiler available as a python module . Most of my code is synchronous, but i've had no problem doing things with setTimeout and XHR requests. Now i've started using PouchDB for local persistence and am trying to find a pretty way to handle promises. At the moment, I am doing this to write to a pouchdb instance: def db_put(): def put_success(doc): print("Put a record in the db. Id: ", doc.id, "rev: ", doc.rev) def put_failure(error): print('Failed to put a record in the db. Error: ', error) strHello = {'_id': "1", 'title

Python in Browser: How to choose between Brython, PyPy.js, Skulpt and Transcrypt?

一曲冷凌霜 提交于 2019-11-27 10:14:35
I'm very excited to see that it is now possible to code Python in the browser. These are the main candidates (please add any I may have overlooked): Brython Skulpt PyPy.js Transcrypt But how to choose between them? The only obvious difference I can see is that Skulpt is based on Python 2, whereas Brython is based on Python 3. Please note: This is not a request for recommendations or opinions. I'm seeking objective facts that would inform an educated choice. fzzylogic Here's some info on Brython vs Transcrypt (July 2016, since Transcrypt was added as an option on this question by the OP),

Best way to integrate Python and JavaScript?

核能气质少年 提交于 2019-11-26 21:28:29
Is it possible to integrate Python and JavaScript? For example, imagine you wanted to be able to define classes in JavaScript and use them from Python (or vice versa). If so, what's the best way? I'm interested not only if this is possible but if anyone has done it within a "serious" project or product . I'm guessing it would be possible using Jython and Rhino , for one example, but I'm curious whether or not anyone's ever actually done this, and if there are solutions for other platforms (especially CPython ). Here's something, a Python wrapper around the SeaMonkey Javascript interpreter...

Python in Browser: How to choose between Brython, PyPy.js, Skulpt and Transcrypt?

若如初见. 提交于 2019-11-26 11:48:27
问题 I\'m very excited to see that it is now possible to code Python in the browser. These are the main candidates (please add any I may have overlooked): Brython Skulpt PyPy.js Transcrypt Pyodide But how to choose between them? The only obvious difference I can see is that Skulpt is based on Python 2, whereas Brython is based on Python 3. Please note: This is not a request for recommendations or opinions. I\'m seeking objective facts that would inform an educated choice. 回答1: Running Python in