# RiotJs Demo
[Riot](https://github.com/riot/riot) is a 'one way binding' component framework, comparable to React but with a far simpler API.
It features a template engine, lifecycle events and tag local namespacing,
all based on HTML5, js and css only.
This demo shows how to write and mount a Riot Tag (sample_tag2.py) in pure Python,
inheriting from a base class which takes care of binding all variables to the tag
instance, so that existing frameworks using riot js based tags can be converted
to Transcrypt, one by one with no(?) effort outside the tag source itself.
The base class is using some direct JS.
Within `color.py` I added a little out of scope lambda function hackery, as a prove
how well Transcrypt transfers Pythons highlevel into Javascript's low level
world.
## Usage
You can add js logic also outside transcrypt js pragmas, see the riot.tag2
function in the html file. See also the approach patching the `tag2` function
of riot (misc folder).
The transcrypt tag is available via `this.py_obj` from the riot tag and vice
versa via `self.riot_tag`.
## Transpiling and Running
Run the demo with no switches on transcrypt and serve `riot_demo.html`
### Multimodule Development & Debugging
1. For multimodule development you want to disable the browser cache if you
serve via a simple ETAG unaware http server, e.g. `python -m HTTPServer`
1. Use a change detector and transpile *everything* on change (incl. the
imports).
#### Console ReTranspile On Change
I find [`entr`](http://entrproject.org/) very convenient:
```
find . -name '*.py' | entr sh -c ' rm -rf __javascript/* ; transcrypt sample2_tag.py'
```
## Misc
For reference reasons I added a classic JS based tag, including a compiled
version. The compilation can also be done (fast) in the browser for such
classic tags.
## Disclaimer:
I am for sure no JS expert, there might be a far more elegant way to
have riot's 'this' and Transcrypt's self in sync, e.g. via JS 'inheritance'
mechanics - or maybe using Transcrypt's object extension methods itself.
Also note, that the logic of the sample2 tag itself should show how
well Transcrypt's generated javascript functions mirror Python's import, inheritance,
assignment and object mutation mechanics - and for sure not how to best organize and
design the actual code.
----
<i>Munich, July 2016, Gunther Klessinger</i>
没有合适的资源?快使用搜索试试~ 我知道了~
Transcrypt:把Python编写的代码转换成JavaScript-python
共792个文件
py:247个
js:200个
tree:174个
需积分: 38 6 下载量 90 浏览量
2021-06-18
18:34:08
上传
评论
收藏 14.54MB ZIP 举报
温馨提示
Transcrypt:把Python编写的代码转换成JavaScript 浏览器中的 Python,为提高速度而预编译:http://www.transcrypt.org 预编译为高度可读、高效的 JavaScript,下载 kB 而不是 MB 多重继承、可选运算符重载、元类、async/await、属性、装饰器、分层模块与面向 Web 的高质量 JavaScript 库的宇宙无缝集成,而不是面向桌面的 Python 纯 Python 3.7 语法,使用 Python 的原生解析器直接从 Python 源代码调试,通过集成的源映射为人类生成 JavaScript,类似于逐行 Python 源代码,可选择使用源代码行号进行注释 闪电般快速的 JavaScript 6 代码:调用缓存、for 循环优化、内联 JavaScript 等。命令行开关尖端的集成静态类型检查和缩小也运行在node.js 包含许多代码示例的广泛文档 Apache 2.0 许可 Pip-install and go! 最新稳定版本:伦敦 >>> 开始使用!_ 感谢所有贡献者! 可读性 如下所示,P
资源推荐
资源详情
资源评论
收起资源包目录
Transcrypt:把Python编写的代码转换成JavaScript-python (792个子文件)
is_version_1.0.0 0B
AUTHORS 510B
make.bat 5KB
run.bat 141B
run.bat 64B
ts.bat 26B
setup.cfg 90B
setup.cfg 24B
workspace.code-workspace 66B
change_case.cpp 603B
.gitignore 458B
.gitignore 18B
pysteroids.html 3KB
pong.html 2KB
riot_transcrypt_shared_code.html 2KB
ios_app_description.html 1KB
riot_demo.html 1KB
animals.html 1KB
labeled_slider.html 748B
static_types.html 727B
bmi.html 694B
d3js_demo.html 685B
cyclejs_http_demo.html 674B
plotly_demo.html 674B
cyclejs_demo.html 608B
react_demo.html 600B
ios_app.html 569B
if_else_event.html 551B
jquery_demo.html 546B
mondrian.html 518B
logo_white.html 459B
logo_sphinx.html 459B
test.html 423B
magnet.html 391B
test_sourcemap_else.html 383B
test.html 372B
hello.html 359B
localtoc.html 353B
test.html 353B
pystone.min.html 345B
pystone.html 341B
test.html 338B
terminal_demo.html 323B
globaltoc.html 321B
hello_bundle.html 309B
static_typing.html 283B
index.html 270B
ajaxlogclient.html 247B
three_demo.html 240B
if_else_prompt.html 202B
while_simple.html 196B
hello_world.html 194B
for_nested.html 186B
for_simple.html 186B
assign.html 184B
snowflake.html 175B
mandala.html 171B
star.html 165B
transcrypt_only.html 125B
module_random.html 121B
results.html 109B
test.html 103B
Transcrypt.html 78B
favicon.ico 318B
MANIFEST.in 294B
MANIFEST.in 76B
compiler.jar 7.29MB
water.jpg 8KB
fabric_downloaded.js 442KB
pystone.js 95KB
org.transcrypt.__runtime__.js 78KB
org.transcrypt.__runtime__.js 78KB
datetime.js 74KB
datetime.js 74KB
__builtin__.js 73KB
test_sourcemap_else.js 72KB
pystone.min.js 39KB
re.js 28KB
re.js 27KB
data_classes.js 22KB
data_classes.js 22KB
div_issues.js 22KB
test_sourcemap_else.min.js 22KB
div_issues.js 21KB
org.transcrypt.autotester.html.js 15KB
org.transcrypt.autotester.html.js 15KB
time.js 15KB
operator_overloading.js 14KB
time.js 14KB
__core__.js 14KB
operator_overloading.js 14KB
re.translate.js 13KB
re.translate.js 13KB
module_datetime.js 12KB
module_datetime.js 12KB
autotest.js 11KB
autotest.js 11KB
org.transcrypt.autotester.js 10KB
arguments.js 10KB
arguments.js 10KB
共 792 条
- 1
- 2
- 3
- 4
- 5
- 6
- 8
资源评论
佐罗先生
- 粉丝: 34
- 资源: 4750
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 35 财务汇报部门历年薪酬统计图表.xlsx
- 39 财务工资发放表.xlsx
- 37 财务工资支出上半年年中总结报告.xlsx
- 38 财务分析工资年度开支表.xlsx
- 41 财务公司部门工资开支分析表.xlsx
- 40 财务分析部门工资支出图表.xlsx
- 42 部门员工工资统计表.xlsx
- 45 年度薪酬费用统计表.xlsx
- 44 人事薪酬管理台账.xlsx
- 48 工资对比分析报表模板.xls
- 47 可视化工资表自动统计1.xlsx
- 46 企业员工工资支出预算表.xlsx
- 43 工资收入对比分析表.xlsx
- 50 薪资分析图表.xlsx
- 49 薪酬数据统计分析报表excel模板.xlsx
- 年度公司薪酬调查分析方案(完整版).docx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功