Skip to content

Commit 31a8672

Browse files
committed
removed nonused-files. added DESKTOP.md with links
1 parent adc30ff commit 31a8672

File tree

9 files changed

+56
-386
lines changed

9 files changed

+56
-386
lines changed

example/DESKTOP.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# CouchDb Client
2+
3+
https://github.com/keroxp/deno-couchdb
4+
5+
https://github.com/YevhenKap/couchdb_dart
6+
7+
https://github.com/shamblett/sporran/blob/6f5ab1b05439d608fb907f1726141a606f9b4a9b/lib/src/sporran_database.dart
8+
9+
https://hasura.io/blog/couchdb-style-conflict-resolution-rxdb-hasura/
10+
11+
https://github.com/sysadminmike/couch-to-postgres/
12+

example/lib/main.dart

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import 'dart:convert';
2+
import 'dart:io';
3+
14
import 'package:flutter/material.dart';
25
import 'package:flutter_js/flutter_js.dart';
36
import 'package:flutter_js_example/ajv_example.dart';
@@ -34,6 +37,8 @@ class _FlutterJsHomeScreenState extends State<FlutterJsHomeScreen> {
3437

3538
String? _quickjsVersion;
3639

40+
Process? _process;
41+
bool _processInitialized = false;
3742
String evalJS() {
3843
String jsResult = javascriptRuntime.evaluate("""
3944
if (typeof MyClass == 'undefined') {
@@ -71,6 +76,7 @@ class _FlutterJsHomeScreenState extends State<FlutterJsHomeScreen> {
7176
super.dispose();
7277
//widget.javascriptRuntime.dispose();
7378
javascriptRuntime.dispose();
79+
_process?.kill(ProcessSignal.sigabrt);
7480
}
7581

7682
@override
@@ -119,6 +125,27 @@ class _FlutterJsHomeScreenState extends State<FlutterJsHomeScreen> {
119125
ElevatedButton(
120126
child: const Text('Fetch Remote Data'),
121127
onPressed: () async {
128+
print('PATH: ${Directory.current}');
129+
if (!_processInitialized)
130+
Process.start(
131+
'node.exe', ['${Directory.current.path}\\script.js'],
132+
mode: ProcessStartMode.detachedWithStdio)
133+
.then((process) {
134+
//print('PROCES: ${process.exitCode}');
135+
if (!_processInitialized) {
136+
_process = process;
137+
process.stdout.pipe(stdout);
138+
process.stderr.pipe(stderr);
139+
process.stdin.writeln('Hi');
140+
}
141+
_processInitialized = true;
142+
}).onError((error, stackTrace) {
143+
print(error.toString());
144+
});
145+
if (_processInitialized && _process != null) {
146+
_process?.stdin.writeln('Hi already initialized');
147+
}
148+
122149
var asyncResult = await javascriptRuntime.evaluateAsync("""
123150
fetch('https://raw.githubusercontent.com/abner/flutter_js/master/cxx/quickjs/VERSION').then(response => response.text());
124151
""");

example/script.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
process.stdin.resume();
2+
process.stdin.setEncoding('utf8');
3+
4+
var readline = require('readline');
5+
var rl = readline.createInterface({
6+
input: process.stdin,
7+
output: process.stdout,
8+
terminal: false
9+
});
10+
11+
rl.write('Olá mundo');
12+
rl.on('line', function(line){
13+
console.log('LINE FROM NODEJS: ' + line);
14+
});
15+
16+
setInterval(() => console.log('HI PERIODIC FROM NODEJS'), 2000);

packages/flutter_js_platform_interface/CHANGELOG.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

packages/flutter_js_platform_interface/LICENSE

Lines changed: 0 additions & 21 deletions
This file was deleted.

packages/flutter_js_platform_interface/README.md

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)