Commit Graph

156 Commits

Author SHA1 Message Date
ringabout
779bc8474b fixes #4299 #12492 #10849; lambda lifting for JS backend (#23484)
fixes #4299 
fixes #12492 
fixes #10849

It binds `function` with `env`: `function.bind(:env)` to ease codegen
for now
2024-04-11 09:14:56 +02:00
Chancy K
c2c00776e3 fix BigInt conversion, xOffset/yOffset to int from int64 (#23404)
Problem described here: https://github.com/karaxnim/karax/issues/284

Co-authored-by: Chancy Kennedy <chancy@conciergecloset.com>
2024-03-15 10:13:40 +08:00
ASVIEST
20d79c9fb0 Deprecate asm stmt for js target (#23149)
why ?

- We already have an emit that does the same thing
- The name asm itself is a bit confusing, you might think it's an alias
for asm.js or something else.
- The asm keyword is used differently on different compiler targets (it
makes it inexpressive).
- Does anyone (other than some compiler libraries) use asm instead of
emit ? If yes, it's a bit strange to use asm somewhere and emit
somewhere. By making the asm keyword for js target deprecated, there
would be even less use of the asm keyword for js target, reducing the
amount of confusion.
- New users might accidentally use a non-universal approach via the asm
keyword instead of emit, and then when they learn about asm, try to
figure out what the differences are.

see https://forum.nim-lang.org/t/10821

---------

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2024-01-02 07:49:54 +01:00
Jake Leahy
44b64e726e Don't recurse into inner functions during asyncjs transform (#23036)
Closes #13341
2023-12-06 04:59:38 +01:00
Thiago
4bf0f846df Removed localStorage.hasKey binding (#22766)
Doesn't exists anymore.

Use `window.localStorage.getItem("key").isNil` instead

![Screenshot from 2023-09-28
07-22-41](https://github.com/nim-lang/Nim/assets/74574275/65d58921-58c7-4a81-9f3b-5faa3a79c4f2)
2023-09-28 11:30:04 +02:00
Juan Carlos
f0865fa696 Fix #21407 (#22759)
- Fix #21407

---------

Co-authored-by: Amjad Ben Hedhili <amjadhedhili@outlook.com>
2023-09-28 07:37:09 +02:00
metagn
03f267c801 make jsffi properly gensym (#22539)
fixes #21208
2023-08-23 19:25:26 +02:00
ringabout
3f7e1d7daa replace doAssert false with raiseAssert in lib, which works better with strictdefs (#22458) 2023-08-11 18:24:46 +02:00
Zoom
656706026b JS: Add some to-cstring converters for DateTime (#21912)
Add some to-cstring converters for DateTime

Changelog update
2023-05-26 16:40:53 +02:00
Thiago
ed7c6cdc98 Fixed window.find return (#21621)
https://developer.mozilla.org/en-US/docs/Web/API/Window/find
2023-04-19 21:51:23 +02:00
metagn
f05387045d int64/uint64 as bigint in JS (#21613)
* int64/uint64 as bigint in JS

* fix CI

* convert to compile option

* fix lie

* smaller diff, changelog entry
2023-04-11 21:20:20 +02:00
Qinsi (James) ZHU
03dd853815 add .replace() with callback to jsre (#21371) 2023-02-16 18:12:48 +01:00
Jake Leahy
cac49694c0 std/asyncjs allow transforming proc types (#21356)
* Add test case

* Implement JS async transform for nnkProcTy
2023-02-14 08:14:19 +01:00
metagn
ce971400c0 dom: remove X* = ref XObj [backport] (#20910)
dom: remove X* = ref XObj
2022-11-29 14:24:51 -05:00
Juan Carlos
b7f1757952 Documentation only, dom (#20584)
Add docs to dom
2022-10-17 20:01:08 +02:00
Andrey Makarov
19ff746916 Markdown code blocks migration part 7 (#20547) 2022-10-12 16:13:43 +02:00
Juan Carlos
2147b116a1 Add missing proc to dom (#20378)
* Add missing proc from dom

* Add missing proc from dom

* Add missing proc from dom

Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com>
2022-09-19 17:51:47 -04:00
Juan Carlos
c8000b1025 Add missing symbols to regex (#20383)
* Add missing attribute to jsre

* Add missing attribute to jsre
2022-09-19 17:47:39 -04:00
Juan Carlos
2c0aaac304 jsffi add missing braces (#19948)
js codegen add missing whitespaces and braces
2022-06-30 23:18:11 +02:00
Juan Carlos
7c31b6a47b Fix jsre (#19917)
* Fixes for jsre to make it more safe at runtime on some edge cases

* https://github.com/nim-lang/Nim/pull/19917#issuecomment-1162692893
2022-06-28 08:13:17 +02:00
Juan Carlos
f2b16c490d Add Microtasks docs (#19870)
* Add Microtasks

* Add Microtasks

* Workaround to build js docs in older NodeJS versions
2022-06-08 16:10:52 +02:00
Juan Carlos
d0232f0e5b Add Microtasks (#19860)
* Add Microtasks

* Add Microtasks
2022-06-04 07:03:25 +02:00
flywind
68aeb4c1a6 change the type of mangleJsName; fixes CStringConv warnings (#19852)
change the type of mangleJsName

since mangleJsName is used in macros, there is no need to use cstring. Using cstring may increase conversions and cause warnings.
2022-06-01 15:01:17 +02:00
tandy1000
ec0cec3170 Add document.hidden and document.visibilityState properties (#19817) 2022-05-24 17:37:39 +02:00
Juan Carlos
b1b5e3ab10 Add Array.shift (#19811)
* Add Array.shift for JavaScript targets

* Add Array.shift for JavaScript targets
2022-05-24 17:37:19 +02:00
tandy1000
4dfe420c2f Add support for Window.matchMedia (#19648) 2022-03-26 06:57:39 +01:00
Juan Carlos
d7a966c4eb Remove Deprecated domextension (#19630)
* Remove Deprecated domextension

* Remove Deprecated domextension
2022-03-23 20:43:28 +01:00
Juan Carlos
f0bfc0bd3f Remove define for jsfetch (#19530)
* Remove define nimExperimentalAsyncjsThen for std/asyncjs.then and std/jsfetch

* Remove define nimExperimentalAsyncjsThen for std/asyncjs.then and std/jsfetch

* Remove define nimExperimentalAsyncjsThen for std/asyncjs.then and std/jsfetch

* Remove define nimExperimentalAsyncjsThen for std/asyncjs.then and std/jsfetch
2022-02-25 20:34:16 +01:00
Juan Carlos
fe791c67b4 Remove Deprecated jsre func (#19551)
* Remove Deprecated jsre func

* Remove Deprecated jsre func

* ReStart CI, because OSX is dumb and I have no permission to restart
2022-02-25 10:43:35 +01:00
flywind
bcbeff3632 remove spaces between an identifier and a star (#19355)
It makes search easier by searching `+`* instead of `+` which filter lots of unexported versions.

Follow https://github.com/nim-lang/Nim/pull/18681
2022-01-10 11:59:44 +01:00
Juan Carlos
041edaa1df Implement RFC-413 (#18749)
* Implement RFC 413

* Implement RFC 413

* Implement RFC 413

* Implement RFC 413

* https://github.com/nim-lang/Nim/pull/18749#discussion_r696320995

* Update lib/js/dom_extensions.nim

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>

* Update lib/js/dom_extensions.nim

* https://github.com/nim-lang/Nim/pull/18749#discussion_r696913310

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2021-08-26 23:07:54 +02:00
Antonis Geralis
36654fd577 Cleanup interval and timeout procs (#18431)
clear/setTimeout procs were using ref ref Timeout. Added more interval overloads. Corrections.
2021-07-05 19:55:46 +01:00
mantielero
d8488e41e8 readAsText supports both Blob and File (fixes #18187) (#18189) 2021-06-21 21:19:11 -07:00
Rainbow Asteroids
295429f425 add dom.scrollIntoView with options; refs #18093 (#18181) 2021-06-05 09:07:26 +02:00
Joey
e904c6d87c Add checked to dom (#18033)
This allows the ability to set a checkbox as checked programmatically. It's different from `setAttribute` because once an input has been clicked on by the user, `setAttribute` no longer works programmatically.
2021-05-17 08:04:39 +02:00
Juan Carlos
5762b1d75c Add copyWithin for JavaScript (#17937)
* Add jscore.copyWithin for seq and array
* Shallow copy mention docs
2021-05-05 07:46:42 +02:00
Yanis Zafirópulos
a55c7e9679 WIP: Added missing functions to jsre module (#17881)
* added missing functions: `replace`, `replaceAll`, `split`, `match`
* added `startsWith` & `endsWith`
* Update lib/js/jsre.nim

Co-authored-by: Juan Carlos <juancarlospaco@gmail.com>
2021-05-01 09:37:02 +02:00
Timothee Cour
2abc936d51 typeof(voidStmt) now works (#17807)
* `typeof(voidStmt)` now works
* remove typeOrVoid
* add condsyms, and reference cligen https://github.com/c-blake/cligen/pull/193
* fixup
* changelog [skip ci]
* fixup
2021-04-23 14:36:38 +02:00
Juan Carlos
f8038af5ec Documentation only, dom (#17770)
* ReSync with Devel

* ReSync

* https://github.com/timotheecour/Nim/issues/674

* Update lib/js/dom.nim

Co-authored-by: flywind <xzsflywind@gmail.com>

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
Co-authored-by: flywind <xzsflywind@gmail.com>
2021-04-19 07:42:38 +02:00
konsumlamm
e4b64eee89 Fix small typos (#17680) 2021-04-09 00:40:19 +02:00
Juan Carlos
fb38d906a2 Improve jsre (#17365)
* Add dollar for regex

* Add dollar for regex

* Peer review feedbacks

* Peer review feedbacks

* Update lib/js/jsre.nim

Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>

* Update lib/js/jsre.nim

Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>

* Update lib/js/jsre.nim

Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>

* Pear review

* Beer review

* Beer review

Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
2021-03-21 10:35:55 +01:00
konsumlamm
9997b42c35 Use importjs (#17422) 2021-03-19 14:22:48 -07:00
Juan Carlos
9e1a2e9b63 improve jsconsole (#17414)
* Add jsconsole.dir

* Update lib/js/jsconsole.nim

Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>

Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
2021-03-19 07:15:37 +01:00
Juan Carlos
cfe2f126e5 Documentation only jsconsole (#17384)
Co-authored-by: Danil Yarantsev <tiberiumk12@gmail.com>
Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
2021-03-16 13:16:20 -07:00
Juan Carlos
0234b479ab Add Debug breakpoints support (#17295)
* Add Debug breakpoints support

* Add Debug breakpoints support
2021-03-08 09:32:49 +01:00
Timothee Cour
a66637bda4 followup #16871 asyncjs.then: allow pipelining procs returning futures (#17189)
* followup #16871 asyncjs.then: allow pipelining procs returning futures
* rename test files where they belong
* fix tests
* tests for then with `onReject` callback
* rename test file containing fail to avoid messing with grep
* address comments
* cleanup
* un-disable 1 test
2021-03-04 14:00:04 +01:00
flywind
ec068a2687 fix #17177 (#17243)
* remove unnecessary when statement

* remove outdated codes

* fix #17177

* add testcase
2021-03-03 11:57:34 +01:00
Timothee Cour
b725e0ed4d make jsconsole.assertion errors less confusing in logs (#17179)
* make jsconsole.assertion errors less confusing in logs

* address comments

* fixup
2021-02-25 14:02:00 +01:00
Timothee Cour
a4e6b242d5 asyncjs: add then, catch for promise pipelining (#16871)
* asyncjs: add then
* improve tests, changelog, API
* fix cryptic windows error: The parameter is incorrect
* address comments
2021-02-24 21:03:21 +01:00
Antonis Geralis
9ded85e1b4 add createElementNS, will hopefully fix svgs for karax (#16938) 2021-02-05 00:33:27 +01:00