@girs/gudev-1.0 4.2.0 → 4.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -8
- package/gudev-1.0.d.ts +22 -0
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -5,25 +5,25 @@
|
|
|
5
5
|

|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
GJS TypeScript type definitions for GUdev-1.0 using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v4.
|
|
8
|
+
GJS TypeScript type definitions for GUdev-1.0 using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v4.4.0.
|
|
9
9
|
|
|
10
10
|
## Install
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
Install the type definitions with npm:
|
|
13
13
|
```bash
|
|
14
14
|
npm install @girs/gudev-1.0
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
## Usage
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
Import it like any other module:
|
|
20
20
|
```ts
|
|
21
21
|
import GUdev from '@girs/gudev-1.0';
|
|
22
22
|
```
|
|
23
23
|
|
|
24
24
|
### Ambient Modules
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
[Ambient modules](https://github.com/gjsify/ts-for-gir/tree/main/packages/cli#ambient-modules) let you write the same import you would in plain JavaScript.
|
|
27
27
|
For this you need to include `@girs/gudev-1.0` or `@girs/gudev-1.0/ambient` in your `tsconfig` or entry point Typescript file:
|
|
28
28
|
|
|
29
29
|
`index.ts`:
|
|
@@ -42,7 +42,7 @@ import '@girs/gudev-1.0'
|
|
|
42
42
|
}
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
The ambient module now resolves with types:
|
|
46
46
|
|
|
47
47
|
```ts
|
|
48
48
|
import GUdev from 'gi://GUdev?version=1.0';
|
|
@@ -50,7 +50,7 @@ import GUdev from 'gi://GUdev?version=1.0';
|
|
|
50
50
|
|
|
51
51
|
### Global import
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
GJS's global `imports.gi` works too, with types.
|
|
54
54
|
For this you need to include `@girs/gudev-1.0` or `@girs/gudev-1.0/import` in your `tsconfig` or entry point Typescript file:
|
|
55
55
|
|
|
56
56
|
`index.ts`:
|
|
@@ -69,7 +69,7 @@ import '@girs/gudev-1.0'
|
|
|
69
69
|
}
|
|
70
70
|
```
|
|
71
71
|
|
|
72
|
-
|
|
72
|
+
That form carries types as well:
|
|
73
73
|
|
|
74
74
|
```ts
|
|
75
75
|
const GUdev = imports.gi.GUdev;
|
|
@@ -77,7 +77,7 @@ const GUdev = imports.gi.GUdev;
|
|
|
77
77
|
|
|
78
78
|
### Bundle
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
Most projects want a bundler. [esbuild](https://esbuild.github.io/) is the smallest thing that works; the [examples directory](https://github.com/gjsify/ts-for-gir/tree/main/examples) has setups for several others.
|
|
81
81
|
|
|
82
82
|
## Other packages
|
|
83
83
|
|
package/gudev-1.0.d.ts
CHANGED
|
@@ -151,6 +151,7 @@ export namespace GUdev {
|
|
|
151
151
|
|
|
152
152
|
// Virtual methods
|
|
153
153
|
/**
|
|
154
|
+
* Signal class handler for the {@link GUdev.Client.SignalSignatures.uevent | GUdev.Client::uevent} signal.
|
|
154
155
|
* @param action
|
|
155
156
|
* @param device
|
|
156
157
|
* @virtual
|
|
@@ -296,6 +297,7 @@ export namespace GUdev {
|
|
|
296
297
|
*
|
|
297
298
|
* https://www.freedesktop.org/software/systemd/man/udev_device_has_current_tag.html
|
|
298
299
|
* @returns A `null` terminated string array of current tags. This array is owned by `device` and should not be freed by the caller.
|
|
300
|
+
* @since 238
|
|
299
301
|
*/
|
|
300
302
|
get_current_tags(): string[];
|
|
301
303
|
|
|
@@ -339,6 +341,7 @@ export namespace GUdev {
|
|
|
339
341
|
/**
|
|
340
342
|
* Gets whether `device` has been initialized.
|
|
341
343
|
* @returns Whether `device` has been initialized.
|
|
344
|
+
* @since 165
|
|
342
345
|
*/
|
|
343
346
|
get_is_initialized(): boolean;
|
|
344
347
|
|
|
@@ -475,6 +478,7 @@ export namespace GUdev {
|
|
|
475
478
|
* Before version 238 the uncached getters would not strip trailing newlines.
|
|
476
479
|
* @param name Name of the sysfs attribute.
|
|
477
480
|
* @returns The value of the sysfs attribute or `false` if there is no such attribute.
|
|
481
|
+
* @since 234
|
|
478
482
|
*/
|
|
479
483
|
get_sysfs_attr_as_boolean_uncached(name: string): boolean;
|
|
480
484
|
|
|
@@ -496,6 +500,7 @@ export namespace GUdev {
|
|
|
496
500
|
* Before version 238 the uncached getters would not strip trailing newlines.
|
|
497
501
|
* @param name Name of the sysfs attribute.
|
|
498
502
|
* @returns The value of the sysfs attribute or 0.0 if there is no such attribute.
|
|
503
|
+
* @since 234
|
|
499
504
|
*/
|
|
500
505
|
get_sysfs_attr_as_double_uncached(name: string): number;
|
|
501
506
|
|
|
@@ -517,6 +522,7 @@ export namespace GUdev {
|
|
|
517
522
|
* Before version 238 the uncached getters would not strip trailing newlines.
|
|
518
523
|
* @param name Name of the sysfs attribute.
|
|
519
524
|
* @returns The value of the sysfs attribute or 0 if there is no such attribute.
|
|
525
|
+
* @since 234
|
|
520
526
|
*/
|
|
521
527
|
get_sysfs_attr_as_int_uncached(name: string): number;
|
|
522
528
|
|
|
@@ -545,6 +551,7 @@ export namespace GUdev {
|
|
|
545
551
|
* This function does blocking I/O, and updates the sysfs attributes cache.
|
|
546
552
|
* @param name Name of the sysfs attribute.
|
|
547
553
|
* @returns The value of the sysfs attribute split into tokens or `null` if there is no such attribute. This array is owned by `device` and should not be freed by the caller. Before version 238 the uncached getters would not strip trailing newlines.
|
|
554
|
+
* @since 234
|
|
548
555
|
*/
|
|
549
556
|
get_sysfs_attr_as_strv_uncached(name: string): string[] | null;
|
|
550
557
|
|
|
@@ -566,6 +573,7 @@ export namespace GUdev {
|
|
|
566
573
|
* Before version 238 the uncached getters would not strip trailing newlines.
|
|
567
574
|
* @param name Name of the sysfs attribute.
|
|
568
575
|
* @returns The value of the sysfs attribute or 0 if there is no such attribute.
|
|
576
|
+
* @since 234
|
|
569
577
|
*/
|
|
570
578
|
get_sysfs_attr_as_uint64_uncached(name: string): number;
|
|
571
579
|
|
|
@@ -582,6 +590,7 @@ export namespace GUdev {
|
|
|
582
590
|
* Before version 238 the uncached getters would not strip trailing newlines.
|
|
583
591
|
* @param name Name of the sysfs attribute.
|
|
584
592
|
* @returns The value of the sysfs attribute or `null` if there is no such attribute. Do not free this string, it is owned by `device`.
|
|
593
|
+
* @since 234
|
|
585
594
|
*/
|
|
586
595
|
get_sysfs_attr_uncached(name: string): string | null;
|
|
587
596
|
|
|
@@ -594,6 +603,7 @@ export namespace GUdev {
|
|
|
594
603
|
/**
|
|
595
604
|
* Gets all tags for `device`.
|
|
596
605
|
* @returns A `null` terminated string array of tags. This array is owned by `device` and should not be freed by the caller.
|
|
606
|
+
* @since 165
|
|
597
607
|
*/
|
|
598
608
|
get_tags(): string[];
|
|
599
609
|
|
|
@@ -603,6 +613,7 @@ export namespace GUdev {
|
|
|
603
613
|
* This only works for devices with properties in the udev
|
|
604
614
|
* database. All other devices return 0.
|
|
605
615
|
* @returns Number of micro-seconds since `device` was initialized or 0 if unknown.
|
|
616
|
+
* @since 165
|
|
606
617
|
*/
|
|
607
618
|
get_usec_since_initialized(): number;
|
|
608
619
|
|
|
@@ -632,6 +643,7 @@ export namespace GUdev {
|
|
|
632
643
|
* functions.
|
|
633
644
|
* @param key Name of sysfs attribute.
|
|
634
645
|
* @returns `true` only if the value for `key` exist.
|
|
646
|
+
* @since 234
|
|
635
647
|
*/
|
|
636
648
|
has_sysfs_attr_uncached(key: string): boolean;
|
|
637
649
|
}
|
|
@@ -698,6 +710,7 @@ export namespace GUdev {
|
|
|
698
710
|
/**
|
|
699
711
|
* All returned devices will be initialized.
|
|
700
712
|
* @returns The passed in `enumerator`.
|
|
713
|
+
* @since 165
|
|
701
714
|
*/
|
|
702
715
|
add_match_is_initialized(): Enumerator;
|
|
703
716
|
|
|
@@ -705,6 +718,7 @@ export namespace GUdev {
|
|
|
705
718
|
* All returned devices will match the given `name`.
|
|
706
719
|
* @param name Wildcard filter for kernel name e.g. "sda*".
|
|
707
720
|
* @returns The passed in `enumerator`.
|
|
721
|
+
* @since 165
|
|
708
722
|
*/
|
|
709
723
|
add_match_name(name: string): Enumerator;
|
|
710
724
|
|
|
@@ -713,6 +727,7 @@ export namespace GUdev {
|
|
|
713
727
|
* @param name Wildcard filter for property name.
|
|
714
728
|
* @param value Wildcard filter for property value.
|
|
715
729
|
* @returns The passed in `enumerator`.
|
|
730
|
+
* @since 165
|
|
716
731
|
*/
|
|
717
732
|
add_match_property(name: string, value: string): Enumerator;
|
|
718
733
|
|
|
@@ -720,6 +735,7 @@ export namespace GUdev {
|
|
|
720
735
|
* All returned devices will match the given `subsystem`.
|
|
721
736
|
* @param subsystem Wildcard for subsystem name e.g. 'scsi' or 'a*'.
|
|
722
737
|
* @returns The passed in `enumerator`.
|
|
738
|
+
* @since 165
|
|
723
739
|
*/
|
|
724
740
|
add_match_subsystem(subsystem: string): Enumerator;
|
|
725
741
|
|
|
@@ -728,6 +744,7 @@ export namespace GUdev {
|
|
|
728
744
|
* @param name Wildcard filter for sysfs attribute key.
|
|
729
745
|
* @param value Wildcard filter for sysfs attribute value.
|
|
730
746
|
* @returns The passed in `enumerator`.
|
|
747
|
+
* @since 165
|
|
731
748
|
*/
|
|
732
749
|
add_match_sysfs_attr(name: string, value: string): Enumerator;
|
|
733
750
|
|
|
@@ -735,6 +752,7 @@ export namespace GUdev {
|
|
|
735
752
|
* All returned devices will match the given `tag`.
|
|
736
753
|
* @param tag A udev tag e.g. "udev-acl".
|
|
737
754
|
* @returns The passed in `enumerator`.
|
|
755
|
+
* @since 165
|
|
738
756
|
*/
|
|
739
757
|
add_match_tag(tag: string): Enumerator;
|
|
740
758
|
|
|
@@ -742,6 +760,7 @@ export namespace GUdev {
|
|
|
742
760
|
* All returned devices will not match the given `subsystem`.
|
|
743
761
|
* @param subsystem Wildcard for subsystem name e.g. 'scsi' or 'a*'.
|
|
744
762
|
* @returns The passed in `enumerator`.
|
|
763
|
+
* @since 165
|
|
745
764
|
*/
|
|
746
765
|
add_nomatch_subsystem(subsystem: string): Enumerator;
|
|
747
766
|
|
|
@@ -750,6 +769,7 @@ export namespace GUdev {
|
|
|
750
769
|
* @param name Wildcard filter for sysfs attribute key.
|
|
751
770
|
* @param value Wildcard filter for sysfs attribute value.
|
|
752
771
|
* @returns The passed in `enumerator`.
|
|
772
|
+
* @since 165
|
|
753
773
|
*/
|
|
754
774
|
add_nomatch_sysfs_attr(name: string, value: string): Enumerator;
|
|
755
775
|
|
|
@@ -757,12 +777,14 @@ export namespace GUdev {
|
|
|
757
777
|
* Add a device to the list of devices, to retrieve it back sorted in dependency order.
|
|
758
778
|
* @param sysfs_path A sysfs path, e.g. "/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda"
|
|
759
779
|
* @returns The passed in `enumerator`.
|
|
780
|
+
* @since 165
|
|
760
781
|
*/
|
|
761
782
|
add_sysfs_path(sysfs_path: string): Enumerator;
|
|
762
783
|
|
|
763
784
|
/**
|
|
764
785
|
* Executes the query in `enumerator`.
|
|
765
786
|
* @returns A list of {@link GUdev.Device} objects. The caller should free the result by using `g_object_unref()` on each element in the list and then `g_list_free()` on the list.
|
|
787
|
+
* @since 165
|
|
766
788
|
*/
|
|
767
789
|
execute(): Device[];
|
|
768
790
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@girs/gudev-1.0",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.4.0",
|
|
4
4
|
"description": "GJS TypeScript type definitions for GUdev-1.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "gudev-1.0.js",
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
"test": "tsc --project tsconfig.json"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@girs/gjs": "^4.
|
|
35
|
-
"@girs/gobject-2.0": "^4.
|
|
36
|
-
"@girs/glib-2.0": "^4.
|
|
34
|
+
"@girs/gjs": "^4.4.0",
|
|
35
|
+
"@girs/gobject-2.0": "^4.4.0",
|
|
36
|
+
"@girs/glib-2.0": "^4.4.0" },
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"typescript": "*"
|
|
39
39
|
},
|