about summary refs log tree commit diff stats
path: root/src/js/javascript.nim
Commit message (Collapse)AuthorAgeFilesLines
* js: override default toString tag of globalbptato2024-04-211-1/+5
| | | | Some JS modules use this to check if they are running in a browser.
* Update code stylebptato2024-04-171-116/+130
| | | | | | * separate params with ; (semicolon) instead of , (colon) * reduce screaming snake case use * wrap long lines
* js: remove automatic function -> closure conversionbptato2024-04-151-10/+16
| | | | | | | | | | | | | | | It's a bad idea for several reasons: * it's inefficient; must allocate an environment for a closure in Nim, even though we already have one in JS * writing macros for automatically creating functions with variadic arguments is suprisingly difficult (see the entire `js/javascript' module) * it never really worked properly, because we never freed the associated function pointer. We hardly used it anyway, so the easiest fix is to get rid of it completely.
* remove dead code, fix openArray casingbptato2024-04-081-2/+2
|
* io: derive DynStream from RootObj (not Stream)bptato2024-03-241-4/+4
| | | | | | | | This way they are no longer compatible, but we no longer need them to be compatible anyway. (This also forces us to throw out the old serialize module, and use packet writers everywhere.)
* dom: add onload content attribute to bodybptato2024-02-241-0/+1
|
* dom: print parse errors to consolebptato2024-02-241-6/+8
| | | | instead of trying to evaluate exceptions...
* regex: re-work compileSearchRegexbptato2024-02-171-0/+1
| | | | | | | I've gotten tired of not being able to search for forward slashes. Now it works like in vim, and you can also set default ignore case in the config.
* js: always use var destructorbptato2024-01-291-8/+2
| | | | See https://forum.nim-lang.org/t/10807
* js: update pragma docsbptato2024-01-241-3/+9
|
* js: define toStringTag properlybptato2024-01-241-3/+3
|
* js: allow specifying static function name, small refactoringbptato2024-01-241-58/+60
| | | | | | | | * static function names can now be defined using the syntax `Class:functionName' (or just use `Class' to take the default name * fix URL.canParse with 1 argument only * do not store JSFuncGenerator for constructors; just put the function node in BoundFunctions
* js: small improvementsbptato2024-01-171-20/+50
| | | | | * turn JSFuncGenerator into a ref object (it's faster this way) * remove strformat dependency
* js: use Nim allocatorbptato2024-01-081-1/+19
|
* Use std/* imports everywherebptato2024-01-071-8/+8
|
* Fix some casing issuesbptato2024-01-061-4/+4
|
* Compile with styleCheck:usagesbptato2023-12-281-1/+1
| | | | much better
* dom: use JS_EvalFunction; add module fetching stubsbptato2023-12-251-0/+7
| | | | (still no module support in buffer...)
* bindings/quickjs: cint -> csize_tbptato2023-12-231-2/+3
| | | | | | cint was incorrect :/ Makes me wonder if maybe we should just use futhark after all...
* js: fix nil deref in jsgetpropbptato2023-12-201-4/+9
| | | | Turns out desc can in fact be nil.
* event: remove ctx from CustomEventbptato2023-12-031-22/+35
| | | | | Instead, make finalizers optionally pass their runtime for resource deallocation.
* js: get rid of emitbptato2023-12-021-22/+15
| | | | now I know how to :P
* js: get rid of getJSValuebptato2023-12-021-10/+9
| | | | just use an UncheckedArray in the binding
* html: add HTMLElement.dataset (+ some twtstr cleanup)bptato2023-12-011-6/+14
|
* js: simplify toJSP0bptato2023-11-301-3/+1
| | | | | | | * Expose js_create_from_ctor from QuickJS and directly use that (instead of badly recreating it) * Do not call defineUnforgeable twice (it is inevitably called in toJSP0, so jsctor does not need it)
* js: allow subclassing platform objects in JSbptato2023-11-301-1/+1
|
* js: remove nonsensical comment linebptato2023-11-261-1/+0
|
* js: refine isInstanceOf check in functionsbptato2023-10-251-9/+4
| | | | Special case the global object, check for inheritance, etc.
* js: define global properties as CONFIGURABLE | WRITABLEbptato2023-10-251-2/+2
|
* reduce new() usagebptato2023-10-251-1/+1
|
* Add jspropnames, CSSStyleDeclaration stubbptato2023-10-251-3/+50
|
* javascript: add TextEncoder, TextDecoderbptato2023-10-211-0/+1
|
* XHR progressbptato2023-10-141-3/+4
| | | | still non-functional
* js: improve optional argument handlingbptato2023-09-261-1/+4
| | | | | | | If a fallback argument has been specified, treat undefined as if no argument had been given. This removes the need for the ?? 1 checks in the config.
* dom: add document.all, misc fixesbptato2023-09-191-3/+7
| | | | | | | | * Fix an issue with Collection cache invalidation (we must invalidate collections of the parent node on insertion, so that it triggers a refresh). * Remove circular reference of document.document, now we use a function instead.
* javascript: static methods, URL.canParsebptato2023-09-171-23/+46
|
* move around more modulesbptato2023-09-141-1/+1
| | | | | | | | | | * ips -> io/ * loader related stuff -> loader/ * tempfile -> extern/ * buffer, forkserver -> server/ * lineedit, window -> display/ * cell -> types/ * opt -> types/
* javascript: fix a GC bugbptato2023-09-091-5/+22
| | | | | | | GC_unref may indirectly call nim_finalize_for_js, which could mess up execution of checkDestroy. I haven't encountered it in refc, but it's definitely present in orc.
* javascript: reference unforgeables in tablebptato2023-09-041-1/+1
| | | | | Conceptually, seqs are by-value. In practice I they are by-ref, but let's not depend on this.
* buffer: basic click event supportbptato2023-08-311-1/+1
| | | | | | | Mostly a proof of concept. Just bubble it unconditionally for now and never prevent default. Also, fix fromJSFunction by Dup'ing its closure JSValue.
* javascript: fix fromJSFunction, simplify setOpaquebptato2023-08-301-1/+1
| | | | | | * fromJSFunction: dup the value, so that it cannot go out of context. * setOpaque no longer calls GC_ref, so no need for it to be generic instead of just taking a pointer.
* javascript: factor out fromJSbptato2023-08-291-489/+4
|
* javascript: move error ctors to js/errorbptato2023-08-291-48/+0
|
* js: fix typobptato2023-08-291-1/+1
|
* Add jsdelprop, allow deletion of ActionMap propsbptato2023-08-291-2/+41
| | | | mostly for symmetry with real objects
* Add jssetprop, make ActionMap editable from JSbptato2023-08-291-3/+48
| | | | | | | | | jssetprop just adds the set_property exotic function. ActionMap is now editable from JS; the setter is implemented in the same way as bindPagerKey/bindLineKey. (In fact, now those two just call the setter.) But this is still rather inefficient and subject to change.
* refactor: Result[T, JSError] -> JSResult[T]bptato2023-08-281-21/+20
|
* javascript: refactorbptato2023-08-281-390/+12
| | | | | | | Split out parts of the JS module, because it was starting to confuse the compiler a little. (Peakmem is back at 750M. Interesting.)
* javascript: de-ref some interfacesbptato2023-08-281-54/+47
| | | | | | | Also, make ActionMap use getters/hasprop instead of a table copy. peakmem remains up +200M at 950M after commit 9991bd3393483158ab0d1b9d995f695dee3c65dc. :(
* javascript: allow by-ref getters to non-ref objectsbptato2023-08-271-36/+161
| | | | | | | | This makes not creating separate reference types for SameObject attributes possible. Also add a fromJS2 "hook" to allow defining fromJS behavior in modules other than javascript.