sendPopEvent method

Future<bool> sendPopEvent()
override

Sending the pop event to close the current page

Implementation

Future<bool> sendPopEvent() async{
  if(_simulator != null) return _simulator!.sendPopEvent();

  final internalMessage = NUIMiniProgramInternalMessage(type: NUIMiniProgramEventType.POP, data: "pop");
  final popMessage = NUIMiniProgramMessage(channel: NUIMiniProgramMessage.DEFAULT_CHANNEL, data: jsonEncode(internalMessage));
  try {
    final result = await sendAndAwaitCrossEvent(popMessage);
    return true;
  }catch(e){
    print("[NUIMiniProgramJSEngine] Failed to send pop event with error : $e");
    return false;
  }
}