Skip to content

Instantly share code, notes, and snippets.

@jmercouris
Created January 7, 2018 01:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmercouris/6ced6e99634f2c10994753c679bacdb2 to your computer and use it in GitHub Desktop.
Save jmercouris/6ced6e99634f2c10994753c679bacdb2 to your computer and use it in GitHub Desktop.
(defparameter *next-interface* nil)
(defparameter *character-conversion-table* (make-hash-table :test 'equalp))
+(defparameter *json-promise* nil)
(defclass next-interface ()
((window :accessor window :initarg :window)
@@ -221,12 +222,15 @@
(print js-str-value)
(print js-str-length)
(print (cffi:convert-from-foreign js-str-length :unsigned-int))
- (print (cffi:convert-from-foreign str-value :string+ptr)))
- nil)
+ (print (cffi:convert-from-foreign str-value :string+ptr))
+ (lparallel:fulfill (cffi:convert-from-foreign str-value :string+ptr))))
(defun web-view-execute (view script)
- (let ((np (cffi:null-pointer)))
- (webkit2:webkit-web-view-run-javascript view script np (cffi:callback callybacky) np)))
+ (setf *json-promise* (lparallel:promise))
+ (synchronous-within-main
+ (let ((np (cffi:null-pointer)))
+ (webkit2:webkit-web-view-run-javascript view script np (cffi:callback callybacky) np))
+ (lparallel:force *json-promise*)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment