[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-iono] branch master updated: expose public api
From: |
gnunet |
Subject: |
[taler-iono] branch master updated: expose public api |
Date: |
Thu, 01 Jul 2021 04:35:42 +0200 |
This is an automated email from the git hooks/post-receive script.
jonathan-buchanan pushed a commit to branch master
in repository iono.
The following commit(s) were added to refs/heads/master by this push:
new f79f1ea expose public api
f79f1ea is described below
commit f79f1ea181a04032818c98c367fece8222110d52
Author: Jonathan Buchanan <jonathan.russ.buchanan@gmail.com>
AuthorDate: Wed Jun 30 22:35:24 2021 -0400
expose public api
---
iono/iono.swift | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/iono/iono.swift b/iono/iono.swift
index 77a4ec5..e4edb8a 100644
--- a/iono/iono.swift
+++ b/iono/iono.swift
@@ -16,7 +16,7 @@
import Foundation
-protocol IonoMessageHandler {
+public protocol IonoMessageHandler {
func handleMessage(message: String)
}
@@ -27,13 +27,13 @@ func notification_callback(payload:
Optional<UnsafePointer<Int8>>,
native.internalOnNotify(payload: string)
}
-class Iono {
+public class Iono {
var instance: OpaquePointer!
var work_queue: DispatchQueue
var initialization_group: DispatchGroup
var messageHandler: IonoMessageHandler?
- init() {
+ public init() {
work_queue = DispatchQueue(label: "NodeQueue", qos: .userInitiated)
initialization_group = DispatchGroup()
initialization_group.notify(queue: work_queue) {
@@ -58,18 +58,18 @@ class Iono {
notifyNative()
}
- func internalOnNotify(payload: String) {
+ public func internalOnNotify(payload: String) {
if let handler = messageHandler {
handler.handleMessage(message: payload)
}
}
- func notifyNative() {
+ public func notifyNative() {
initialization_group.wait()
__notifyNative(instance)
}
- func evalSimpleJs(source: String) -> String {
+ public func evalSimpleJs(source: String) -> String {
var result: String?
scheduleNodeThreadSync {
let cResult = __evalJs(self.instance, source.cString(using: .utf8))
@@ -81,13 +81,13 @@ class Iono {
return result!
}
- func evalNodeCode(source: String) {
+ public func evalNodeCode(source: String) {
scheduleNodeThreadAsync {
__makeCallbackNative(self.instance, source.cString(using: .utf8))
}
}
- func sendMessage(message: String) {
+ public func sendMessage(message: String) {
let encoded = message.data(using: .utf8)!.base64EncodedString()
let source = """
if (global.__iono_onMessage) {
@@ -100,11 +100,11 @@ class Iono {
evalNodeCode(source: source)
}
- func waitStopped() {
+ public func waitStopped() {
}
- func putModuleCode(modName: String, code: String) {
+ public func putModuleCode(modName: String, code: String) {
scheduleNodeThreadSync {
__putModuleCodeNative(self.instance, modName.cString(using: .utf8),
code.cString(using: .utf8))
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-iono] branch master updated: expose public api,
gnunet <=