Commit Graph

19 Commits

Author SHA1 Message Date
LJ
27a8abbdec
PORTS: Support all serializable data. (#1089)
A significant portion of players who use ports are passing objects through them. Currently they are required to handle that themselves via JSON serialization. This PR adds better support for passing objects; which is more convenient, extensive, and optimized (probably, more on this one later).

This adds zero overhead to existing (or when passing any primitive types) port usage, and also isn't a breaking change. The questions to debate here are:

Should objects be supported in the first place?
If so, how exactly do we want to serialize objects?
Based on an extensive discussion in Discord, the overwhelming majority answered "yes" to question one. As for question two, that has been much more hotly contested.

Ultimately, `structuredClone` was used, despite less-than-stellar performance, because other options were worse either in safety, speed, error-handling, or multiple of the above.
2024-02-17 19:15:17 -08:00
Justin
39c5a356b1
BUGFIX: Fix writePort() error where deconstructing the Port class caused the reduce() function to lose its 'this' reference (#1037) 2024-01-15 06:14:13 -05:00
LJ
157ff8ea88
PORTS: Add ns.nextPortWrite() as a safer option (#1036) 2024-01-15 06:10:39 -05:00
Snarling
44f0a77c4e
PORTS: One promise, one resolver (test) (#1022) 2024-01-14 16:05:57 -05:00
LJ
1ce0584b25
MISC: Switch port.nextWrite() from LIFO to FIFO (#965) 2023-12-07 18:00:01 -05:00
Snarling
ebae35b1fb
CODEBASE: Expand lint rules, and Aliases are stored as maps (#501) 2023-05-05 03:55:59 -04:00
Snarling
759f86d6e5
NETSCRIPT: Rework script ram updates (#408) 2023-03-05 22:39:42 -05:00
T.J. Eckman
33f0150d25
BUGFIX: Memory Leak in NetscriptPorts (#399)
Co-authored-by: Snarling <84951833+Snarling@users.noreply.github.com>
2023-02-27 19:54:04 -05:00
LJ
9eb5f7ef23
NETSCRIPT: added portHandle.nextWrite() (#187) 2022-11-03 06:17:29 -04:00
omuretsu
7a384d53f4 typefix netscriptFunctions (see desc)
* Types for InternalFunction and ExternalFunction have been modified to actually typecheck ns functions against docs.
* Internal functions are required to use unknown for any params on the inner function.
* Return types for internal function inner-function must match the respective external function.
* Added new typecheck assertion function for asserting dynamic object types, to allow unknownifying params that were previously hardcoded objec structures.
* Because type assertion for parameter types and return types is enforced by InternalAPI, removed all duplicate type declarations on NetscriptFunction params and returns.
2022-10-12 08:49:27 -04:00
Olivier Gagnon
fbd6b1b28c fix any in NetscriptPorts 2022-07-18 03:09:19 -04:00
Olivier Gagnon
610bcd6315 fix any in NetscriptPort 2022-07-18 03:00:51 -04:00
BB
7212cc2f1c Removed unnecessary eslint-disable lines 2022-03-01 17:33:27 +01:00
Olivier Gagnon
4abc1df840 convert to ts 2021-09-24 17:56:30 -04:00
Olivier Gagnon
dc518e7032 asdf 2021-09-21 20:39:25 -04:00
Olivier Gagnon
a18bdd6afc prettify, sorry for the big ass commit 2021-09-04 19:09:30 -04:00
Olivier Gagnon
d745150c45 all the lints 2021-05-01 03:17:31 -04:00
Olivier Gagnon
3fad505096 run auto fix lint 2021-04-29 23:52:56 -04:00
Olivier Gagnon
6c0b5b3ed9 Converting random pieces of code to ts 2021-03-14 01:08:24 -05:00