rustdesk/lib/web_model.dart

32 lines
753 B
Dart
Raw Normal View History

2022-01-25 18:13:11 +08:00
import 'dart:typed_data';
2022-01-26 12:48:16 +08:00
import 'dart:js' as js;
2022-01-25 18:13:11 +08:00
import 'common.dart';
2022-01-26 12:48:16 +08:00
class PlatformFFI {
2022-01-25 18:13:11 +08:00
static void clearRgbaFrame() {}
2022-01-26 12:48:16 +08:00
static Uint8List getRgba() {
2022-01-29 15:55:00 +08:00
return js.context.callMethod('getRgba');
2022-01-25 18:13:11 +08:00
}
2022-01-26 19:00:23 +08:00
static Future<String> getVersion() async {
2022-01-31 16:22:05 +08:00
return getByName('version');
2022-01-26 19:00:23 +08:00
}
2022-01-26 12:48:16 +08:00
static String getByName(String name, [String arg = '']) {
return js.context.callMethod('getByName', [name, arg]);
2022-01-25 18:13:11 +08:00
}
2022-01-26 12:48:16 +08:00
static void setByName(String name, [String value = '']) {
js.context.callMethod('setByName', [name, value]);
2022-01-25 18:13:11 +08:00
}
2022-01-26 12:48:16 +08:00
static Future<Null> init() async {
isWeb = true;
2022-01-31 16:22:05 +08:00
isDesktop = !js.context.callMethod('isMobile');
2022-01-26 19:00:23 +08:00
js.context.callMethod('init');
2022-01-25 18:13:11 +08:00
}
}
2022-01-26 12:48:16 +08:00
final localeName = js.context.callMethod('getLanguage') as String;