From 4d5c7a7b514c7f4f71b2950f051b64c3e3df3008 Mon Sep 17 00:00:00 2001 From: Aylur Date: Sat, 14 Sep 2024 09:55:29 +0000 Subject: docs: lib examples consistency --- docs/libraries/bluetooth.md | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) (limited to 'docs/libraries/bluetooth.md') diff --git a/docs/libraries/bluetooth.md b/docs/libraries/bluetooth.md index e37593f..04d9db2 100644 --- a/docs/libraries/bluetooth.md +++ b/docs/libraries/bluetooth.md @@ -69,34 +69,31 @@ bluetoothctl --help :::code-group ```js [ JavaScript] -import Bluetooth from "gi://AstalBluetooth"; +import Bluetooth from "gi://AstalBluetooth" -const bluetooth = Bluetooth.get_default(); +const bluetooth = Bluetooth.get_default() -console.log(bluetooth.get_devices().map((d) => d.name)); +for (const device of bluetooth.get_devices()) { + print(device.name) +} ``` ```py [ Python] -import gi +from gi.repository import AstalBluetooth as Bluetooth -gi.require_version("AstalBluetooth", "0.1") +bluetooth = Bluetooth.get_default() -from gi.repository import AstalBluetooth - -bluetooth = AstalBluetooth.get_default() - -print("\n".join(d.get_name() for d in bluetooth.get_devices())) +for device in bluetooth.get_devices(): + print(device.get_name()) ``` ```lua [ Lua] -local lgi = require("lgi") - -local AstalBluetooth = lgi.require("AstalBluetooth", "0.1") +local Bluetooth = require("lgi").require("AstalBluetooth") -local bluetooth = AstalBluetooth.get_default() +local bluetooth = Bluetooth.get_default() for _, d in ipairs(bluetooth.devices) do - print(d.name) + print(d.name) end ``` -- cgit v1.2.3