mirror of
https://github.com/wgh136/flutter_qjs.git
synced 2025-09-27 13:27:24 +00:00
add option to change max stack size.
This commit is contained in:
@@ -23,6 +23,9 @@ class FlutterQjs {
|
||||
Pointer _rt;
|
||||
Pointer _ctx;
|
||||
|
||||
/// Max stack size for quickjs.
|
||||
final int stackSize;
|
||||
|
||||
/// Message Port for event loop. Close it to stop dispatching event loop.
|
||||
ReceivePort port = ReceivePort();
|
||||
|
||||
@@ -35,7 +38,7 @@ class FlutterQjs {
|
||||
/// Quickjs engine for flutter.
|
||||
///
|
||||
/// Pass handlers to implement js-dart interaction and resolving modules.
|
||||
FlutterQjs({this.methodHandler, this.moduleHandler});
|
||||
FlutterQjs({this.methodHandler, this.moduleHandler, this.stackSize});
|
||||
|
||||
_ensureEngine() {
|
||||
if (_rt != null) return;
|
||||
@@ -69,6 +72,8 @@ class FlutterQjs {
|
||||
return err;
|
||||
}
|
||||
}, port);
|
||||
if (this.stackSize != null && this.stackSize > 0)
|
||||
jsSetMaxStackSize(_rt, this.stackSize);
|
||||
_ctx = jsNewContextWithPromsieWrapper(_rt);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user