wasm work

This commit is contained in:
John Smith
2023-05-15 21:20:54 -04:00
parent cbdbd34af8
commit 46e67d7b0c
10 changed files with 1016 additions and 248 deletions
-89
View File
@@ -9,95 +9,6 @@ import 'dart:typed_data';
import 'veilid_encoding.dart';
//////////////////////////////////////////////////////////
// WASM Platform-specific config
class VeilidWASMConfigLoggingPerformance {
bool enabled;
VeilidConfigLogLevel level;
bool logsInTimings;
bool logsInConsole;
VeilidWASMConfigLoggingPerformance({
required this.enabled,
required this.level,
required this.logsInTimings,
required this.logsInConsole,
});
Map<String, dynamic> toJson() {
return {
'enabled': enabled,
'level': level.toJson(),
'logs_in_timings': logsInTimings,
'logs_in_console': logsInConsole,
};
}
VeilidWASMConfigLoggingPerformance.fromJson(dynamic json)
: enabled = json['enabled'],
level = veilidConfigLogLevelFromJson(json['level']),
logsInTimings = json['logs_in_timings'],
logsInConsole = json['logs_in_console'];
}
class VeilidWASMConfigLoggingApi {
bool enabled;
VeilidConfigLogLevel level;
VeilidWASMConfigLoggingApi({
required this.enabled,
required this.level,
});
Map<String, dynamic> toJson() {
return {
'enabled': enabled,
'level': level.toJson(),
};
}
VeilidWASMConfigLoggingApi.fromJson(dynamic json)
: enabled = json['enabled'],
level = veilidConfigLogLevelFromJson(json['level']);
}
class VeilidWASMConfigLogging {
VeilidWASMConfigLoggingPerformance performance;
VeilidWASMConfigLoggingApi api;
VeilidWASMConfigLogging({required this.performance, required this.api});
Map<String, dynamic> toJson() {
return {
'performance': performance.toJson(),
'api': api.toJson(),
};
}
VeilidWASMConfigLogging.fromJson(dynamic json)
: performance =
VeilidWASMConfigLoggingPerformance.fromJson(json['performance']),
api = VeilidWASMConfigLoggingApi.fromJson(json['api']);
}
class VeilidWASMConfig {
VeilidWASMConfigLogging logging;
VeilidWASMConfig({
required this.logging,
});
Map<String, dynamic> toJson() {
return {
'logging': logging.toJson(),
};
}
VeilidWASMConfig.fromJson(dynamic json)
: logging = VeilidWASMConfigLogging.fromJson(json['logging']);
}
//////////////////////////////////////////////////////////
Veilid getVeilid() => VeilidJS();