mirror of
https://github.com/EthanShoeDev/fressh.git
synced 2026-01-11 06:12:51 +00:00
use init function
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user