mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-19 23:01:22 -06:00
FIX: async evaluateJavaScript on vebwiew on MacOS
Change-Id: If4c34ef0e9b23622047842bada5a32efcee04498
This commit is contained in:
parent
9df3e7500a
commit
4b4e70efcb
3 changed files with 20 additions and 1 deletions
|
@ -10,6 +10,7 @@ namespace GUI {
|
|||
extern bool mac_dark_mode();
|
||||
extern double mac_max_scaling_factor();
|
||||
extern void set_miniaturizable(void * window);
|
||||
void WKWebView_evaluateJavaScript(void * web, wxString const & script, void (*callback)(wxString const &));
|
||||
|
||||
void initGestures(void * view, wxEvtHandler * handler);
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#import "MacDarkMode.hpp"
|
||||
#include "wx/osx/core/cfstring.h"
|
||||
|
||||
#import <algorithm>
|
||||
|
||||
|
@ -57,6 +58,16 @@ void set_miniaturizable(void * window)
|
|||
}
|
||||
}
|
||||
|
||||
void WKWebView_evaluateJavaScript(void * web, wxString const & script, void (*callback)(wxString const &))
|
||||
{
|
||||
[(WKWebView*)web evaluateJavaScript:wxCFStringRef(script).AsNSString() completionHandler: ^(id result, NSError *error) {
|
||||
if (callback && error != nil) {
|
||||
wxString err = wxCFStringRef(error.localizedFailureReason).AsString();
|
||||
callback(err);
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue