[gjs: 1/2] doc: Document byteArray deprecation and migration




commit fbdca96362d23c9e1905f171625e82c023a18d44
Author: Sonny Piers <sonny fastmail net>
Date:   Wed Aug 3 16:05:02 2022 +0200

    doc: Document byteArray deprecation and migration

 doc/ByteArray.md | 16 ++++++++++++++++
 doc/Modules.md   | 15 ++++++++++++++-
 2 files changed, 30 insertions(+), 1 deletion(-)
---
diff --git a/doc/ByteArray.md b/doc/ByteArray.md
index 53b65fe2c..d1c5bd3ea 100644
--- a/doc/ByteArray.md
+++ b/doc/ByteArray.md
@@ -25,6 +25,10 @@ new `Uint8Array` of the same length as the String, then assigns each
 `Uint8Array` entry the corresponding byte value of the String encoded
 according to the given encoding (or UTF-8 if not given).
 
+**DEPRECATED**
+
+Use `new TextEncoder(encoding).encode(string)` instead.
+
 ### `toString(a:Uint8Array, encoding:String):String` ###
 
 Converts the `Uint8Array` into a literal string. The bytes are
@@ -32,12 +36,24 @@ interpreted according to the given encoding (or UTF-8 if not given).
 
 The resulting string is guaranteed to round-trip back into an identical ByteArray by passing the result to 
`ByteArray.fromString()`, i.e., `b === ByteArray.fromString(ByteArray.toString(b, encoding), encoding)`.
 
+**DEPRECATED**
+
+Use `new TextDecoder(encoding).decode(string)` instead.
+
 ### `fromGBytes(b:GLib.Bytes):Uint8Array` ###
 
 Convert a `GLib.Bytes` instance into a newly constructed `Uint8Array`.
 The contents are copied.
 
+**DEPRECATED**
+
+Use `GLib.Bytes.prototype.toArray` instead.
+
 ### `toGBytes(a:Uint8Array):GLib.Bytes` ###
 
 Converts the `Uint8Array` into a `GLib.Bytes` instance.
 The contents are copied.
+
+**DEPRECATED**
+
+Use `new GLib.Bytes(a:Uint8Array)` instead.
diff --git a/doc/Modules.md b/doc/Modules.md
index f176b2cf8..1e5755199 100644
--- a/doc/Modules.md
+++ b/doc/Modules.md
@@ -59,6 +59,8 @@ Mostly GtkBuilder/composite template implementation. May be useful as a referenc
 
 ```js
 import Gtk from 'gi://Gtk?version=3.0';
+// or
+import Gtk from 'gi://Gtk?version=4.0';
 ```

 
@@ -276,7 +278,18 @@ The System module offers a number of useful functions and properties for debuggi
 
 [example-application]: https://gitlab.gnome.org/GNOME/gjs/blob/HEAD/examples/gtk-application.js
 
-## [Tweener](https://gitlab.gnome.org/GNOME/gjs/blob/HEAD/modules/script/tweener/)
+
+## [bytearray](https://gitlab.gnome.org/GNOME/gjs/blob/HEAD/modules/system.cpp)
+
+**DEPRECATED**
+
+`const byteArray = imports.byteArray;`
+
+See [ByteArray](ByteArray.md).
+
+## [Tweener](https://gitlab.gnome.org/GNOME/gjs/-/blob/HEAD/modules/script/tweener/tweener.js)
+
+**DEPRECATED**
 
 **Import with `const Tweener = imports.tweener.tweener;`**
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]