forked from Blendman974/faceclaw
Kotlin on iOS
This commit is contained in:
1 parent
63b2a7d545
commit
bc8e80c533
12 files changed
+149
-57
No files matched your search
@@ -0,0 +1,31 @@
|
||||
import type { KotlinBridge } from './kotlin-platform';
|
||||
|
||||
// Handwritten declarations for the small native surface, checked against the
|
||||
// compiled API. NativeScript runtime metadata is generated from the AAR.
|
||||
declare namespace com.faceclaw.shared {
|
||||
class KotlinBridge extends java.lang.Object {
|
||||
constructor();
|
||||
platform(): string;
|
||||
threadName(): string;
|
||||
isMainThread(): boolean;
|
||||
greet(name: string): string;
|
||||
roundTrip(message: string, listener: KotlinBridgeListener): string;
|
||||
}
|
||||
class KotlinBridgeListener extends java.lang.Object {
|
||||
constructor(implementation: { transform(message: string): string });
|
||||
}
|
||||
}
|
||||
|
||||
export function createKotlinBridge(): KotlinBridge {
|
||||
const bridge = new com.faceclaw.shared.KotlinBridge();
|
||||
return {
|
||||
platform: () => bridge.platform(),
|
||||
threadName: () => bridge.threadName(),
|
||||
isMainThread: () => bridge.isMainThread(),
|
||||
greet: name => bridge.greet(name),
|
||||
roundTrip(message, transform) {
|
||||
const listener = new com.faceclaw.shared.KotlinBridgeListener({ transform });
|
||||
return bridge.roundTrip(message, listener);
|
||||
},
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user