blob: 60ca92b2f5c49112964860d3e6403e43d980b83c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
//
// NodeWrapper.swift
// Taler
//
// Created by Jonathan Buchanan on 1/14/21.
// Copyright © 2021 Taler. All rights reserved.
//
import Foundation
class Iono {
var __instance: OpaquePointer
var messageHandler: ((String) -> ())?
init() {
__instance = __new_instance()
}
deinit {
__free_instance(__instance)
}
func notifyNative() {
}
func evalJS(source: String) -> String {
var result_cstr: UnsafeMutablePointer<Int8> = __eval_js(source.cString(using: .utf8), __instance)
var result = String(cString: result_cstr)
free(result_cstr)
return result
}
func evalNodeCode(source: String) {
__make_callback(source.cString(using: .utf8), __instance)
}
func sendMessage(message: String) {
}
func waitUntilStopped() {
}
func putModuleCode(moduleName: String, code: String) {
__put_module_code(moduleName.cString(using: .utf8), code.cString(using: .utf8), __instance)
}
}
|