v1.3.0.0 - WebSocket client, async File ops, & other new API #8
mpaperno
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Note: Reading these notes at the documentation's site will provide links to all the new API features.
Plugin Core
ones with asynchronous event handlers, timers, the new WebSockets client, and so forth. In most cases there should be no appreciable practical difference. However,
the old multi-threaded behavior can be restored using the new related plugin setting. If your current scripts runs stable and you think benefit from multi-threading,
you may re-enable this feature (at your own risk :) ).
New JS Library Features
WebSocketclient and simplifiedNet.wsGet()andNet.wsSend()utility functions.FSWatcherclass for monitoring changes to files and directories.Fileutility type gets many enchancements (see docs for details):readAsync(),readLinesAsync(),copyAsync(),renameAsync(),removeAsync()andwriteAsync(). These can return aPromiseor accept a callback argument.write(),copy()andrename()functions (and their new async counterparts) which can handle errors more gracefully.copy()andrename()can now be set to overwrite existing files instead of failing.File.throwExceptionsproperty.TP.triggerGenericEvent().TPButtonutility class which can synchronize visual state properties with an actual Touch Portal button via automatic state updates (see docs for details and button template).on(),off()andonce()methods, more inline with common standards. General documentation in newEvent Handlingsection. Also updated docs for all events throughout the various APIs.inspect(),console.dir(),printf()and%%o/%%Ospecifier support forsprintf()/printf(). Also convenience formatting functionsconsole.infof(),console.warnf(),console.errorf().structuredClone()JS standard function (as polyfill).openUrlExternally()global function which launches the system-defined handler for various URL schemes or file types.callLater()andgcLater()global functions which automatically consolidate multiple calls.URLclass extensions (eg. for working with local file URLs) and also the missingURL.parse()andURL.canParse()standards.URLtype now has own documentation section.String.elideLeft(),String.elideMiddle(), andString.elideRight()methods and static functions for trimming strings with an added visual indicator.Color.toWebColor()/Color.web()methods to return RGB/RRGGBB/RGBA/RRGGBBAA format based on alpha value being opaque or not, and staticColor.fromArgb()andColor.argb2rgba()functions. Updated documentation to list the many suppoorted color input formats.DSE.aboutToQuitevent which is fired just before plugin exits (stops running for whatever reason, besides crashing).DOMExceptionconstant equivalents of all standard exception names (eg.DOMException.AbortError), which can be compared tocodeproperty instead of using string names. Constructor also accepts constant as 2nd argument instead of name.Fixes
Previously, the script engine could be capturing some errors before returning to the main event loop, preventing any user code from running and catching them. Now it will check "lazily" and allow user events to run before checking for uncaught exceptions.
instanceof DOMExceptionnow evaluates correctly forDOMExceptiontypes. Note thatDOMExceptioninherits fromErrorsoinstanceof Erroralso returnstrue, which it already did prior to this fix.Other Changes
Full log: v1.2.1...v1.3.0
This discussion was created from the release v1.3.0.0 - WebSocket client, async File ops, & other new API.
Beta Was this translation helpful? Give feedback.
All reactions