Compile plainly without imports or module definition
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 30/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- javascript, python
- Lĩnh vực
- compilers
Hướng nghiên cứu
The issue names no source file or test; begin by reproducing the Python example and checking the compiler's available output options. Done means an option can produce the requested plain JavaScript without the generated runtime import or module definition, with the result verified for this example.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
I'm trying to compile a single function for use as argument into Browserless, a headless Chrome instance.
# Python src
async def action():
def resolver(resolve, reject):
totalHeight = 0
distance = 100
def scroller():
scrollHeight = document.body.scrollHeight
window.scrollBy(0, distance)
totalHeight += distance
if totalHeight >= scrollHeight:
clearInterval(timer)
resolve()
timer = setInterval(scroller, 100)
await __new__ (Promise(resolver))
Compiles to:
// Transcrypt'ed from Python, 2019-09-20 11:52:53
import {AssertionError, AttributeError, BaseException, DeprecationWarning, Exception, IndexError, IterableError, KeyError, NotImplementedError, RuntimeWarning, StopIteration, UserWarning, ValueError, Warning, __JsIterator__, __PyIterator__, __Terminal__, __add__, __and__, __call__, __class__, __envir__, __eq__, __floordiv__, __ge__, __get__, __getcm__, __getitem__, __getslice__, __getsm__, __gt__, __i__, __iadd__, __iand__, __idiv__, __ijsmod__, __ilshift__, __imatmul__, __imod__, __imul__, __in__, __init__, __ior__, __ipow__, __irshift__, __isub__, __ixor__, __jsUsePyNext__, __jsmod__, __k__, __kwargtrans__, __le__, __lshift__, __lt__, __matmul__, __mergefields__, __mergekwargtrans__, __mod__, __mul__, __ne__, __neg__, __nest__, __or__, __pow__, __pragma__, __proxy__, __pyUseJsNext__, __rshift__, __setitem__, __setproperty__, __setslice__, __sort__, __specialattrib__, __sub__, __super__, __t__, __terminal__, __truediv__, __withblock__, __xor__, abs, all, any, assert, bool, bytearray, bytes, callable, chr, copy, deepcopy, delattr, dict, dir, divmod, enumerate, filter, float, getattr, hasattr, input, int, isinstance, issubclass, len, list, map, max, min, object, ord, pow, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, round, set, setattr, sorted, str, sum, tuple, zip} from './org.transcrypt.__runtime__.js';
var __name__ = '__main__';
export var action = async function () {
var resolver = function (resolve, reject) {
var totalHeight = 0;
var distance = 100;
var scroller = function () {
var scrollHeight = document.body.scrollHeight;
window.scrollBy (0, distance);
totalHeight += distance;
if (totalHeight >= scrollHeight) {
clearInterval (timer);
resolve ();
}
};
var timer = setInterval (scroller, 100);
};
await new Promise (resolver);
};
//# sourceMappingURL=scrolltobottom.map
But I am hoping to be able to generate a non-module version. Like this:
// ideal plain non-module JS
async function () {
var resolver = function (resolve, reject) {
var totalHeight = 0;
var distance = 100;
var scroller = function () {
var scrollHeight = document.body.scrollHeight;
window.scrollBy (0, distance);
totalHeight += distance;
if (totalHeight >= scrollHeight) {
clearInterval (timer);
resolve ();
}
};
var timer = setInterval (scroller, 100);
};
await new Promise (resolver);
};
Is there an option available that makes this possible?
- Ngôn ngữ chính
- Python
- Star
- 2.9k
- Fork
- 218
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của TranscryptOrg/Transcrypt
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
TranscryptOrg/Transcrypt#913 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
TranscryptOrg/Transcrypt#911 · 2 bình luận ·
-
IS: bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
TranscryptOrg/Transcrypt#908 ·
-
SUB: documentation
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 62/100
TranscryptOrg/Transcrypt#656 · 7 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 76/100
TranscryptOrg/Transcrypt#914 ·
Tất cả issue của TranscryptOrg/Transcrypt
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
zostera/django-bootstrap4#894 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
use-agent-os/agent-os#3276 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
zephyrproject-rtos/zephyr#119726 ·
-
area/auth bug comp/agent P3 platform/discord type/security
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
NousResearch/hermes-agent#117848 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
zilliztech/memsearch#759 ·