use init function

This commit is contained in:
EthanShoeDev
2025-09-13 00:01:49 -04:00
parent 44746b5f3d
commit 4ca8b37418
2 changed files with 24 additions and 22 deletions

View File

@@ -13,7 +13,7 @@ import {
secretsManager,
} from '../lib/secrets-manager';
import { sshConnectionManager } from '../lib/ssh-connection-manager';
import { result } from '../lib/test-uniffi-russh';
import '../lib/test-uniffi-russh';
const defaultValues: ConnectionDetails = {
host: 'test.rebex.net',
port: 22,
@@ -119,9 +119,7 @@ export default function Index() {
>
<View style={styles.header}>
<Text style={styles.appName}>fressh</Text>
<Text style={styles.appTagline}>
A fast, friendly SSH client {result}
</Text>
<Text style={styles.appTagline}>A fast, friendly SSH client</Text>
</View>
<View style={styles.card}>
<Text style={styles.title}>Connect to SSH Server</Text>

View File

@@ -3,30 +3,34 @@ import {
type BinaryOperator,
SafeAddition,
type ComputationResult,
uniffiInitAsync,
} from '@fressh/react-native-uniffi-russh';
const calculator = new Calculator();
void uniffiInitAsync().then(() => {
const calculator = new Calculator();
const addOp = new SafeAddition();
const addOp = new SafeAddition();
class SafeMultiply implements BinaryOperator {
perform(lhs: bigint, rhs: bigint): bigint {
return lhs * rhs;
class SafeMultiply implements BinaryOperator {
perform(lhs: bigint, rhs: bigint): bigint {
return lhs * rhs;
}
}
}
const multOp = new SafeMultiply();
const multOp = new SafeMultiply();
// bigints
const three = 3n;
const seven = 7n;
// bigints
const three = 3n;
const seven = 7n;
// Perform the calculation, and to get an object
// representing the computation result.
const computation: ComputationResult = calculator
.calculate(addOp, three, three)
.calculateMore(multOp, seven)
.lastResult()!;
// Perform the calculation, and to get an object
// representing the computation result.
const computation: ComputationResult = calculator
.calculate(addOp, three, three)
.calculateMore(multOp, seven)
.lastResult()!;
// Unpack the bigint value into a string.
export const result = computation.value.toString();
// Unpack the bigint value into a string.
const result = computation.value.toString();
console.log('AAAAAAAAAAAAAAAAAAAAAAAAAA', result);
});