Merge pull request #276 from ebrasca/master

Add set-on-pop-state and url-push-state
This commit is contained in:
David Botton 2023-06-14 12:42:03 -04:00 committed by GitHub
commit cf26d1bafa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 0 deletions

View file

@ -497,6 +497,27 @@ ON-ANIMATION-FRAME-HANDLER is nil unbind the event."))
(defmethod set-on-animation-frame ((obj clog-window) handler)
(set-on-event-with-data obj "clog-animate" handler))
;;;;;;;;;;;;;;;;;;;;;;
;; set-on-pop-state ;;
;;;;;;;;;;;;;;;;;;;;;;
(defgeneric set-on-pop-state (clog-window on-pop-state-handler)
(:documentation "Set the ON-POP-STATE-HANDLER for CLOG-WINDOW. If ON-POP-STATE-HANDLER
is nil unbind the event."))
(defmethod set-on-pop-state ((obj clog-window) handler)
(set-on-event obj "popstate" handler))
;;;;;;;;;;;;;;;;;;;;
;; url-push-state ;;
;;;;;;;;;;;;;;;;;;;;
(defgeneric url-push-state (clog-window rewrite-url)
(:documentation "Method adds an entry to the browser's session history stack."))
(defmethod url-push-state ((obj clog-window) rewrite-url)
(execute obj (format nil "history.pushState({},'','~A')" rewrite-url)))
;;;;;;;;;;;;;;;;;;;;
;; set-on-storage ;;
;;;;;;;;;;;;;;;;;;;;

View file

@ -971,6 +971,10 @@ embedded in a native template application.)"
(resize-by generic-function)
(resize-to generic-function)
"CLOG-Window - History"
(set-on-pop-state generic-function)
(url-push-state generic-function)
"CLOG-Window - Storage Methods"
(storage-type type)
(storage-length generic-function)