mirror of
https://github.com/rabbibotton/clog.git
synced 2025-12-06 02:30:42 -08:00
Improve caching
This commit is contained in:
parent
1c9fa342ad
commit
370b28fc74
2 changed files with 13 additions and 6 deletions
|
|
@ -84,6 +84,16 @@ during attachment. (Private)"))
|
|||
"'body'"
|
||||
(format nil "clog['~A']" (html-id obj))))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;
|
||||
;; cached-excute ;;
|
||||
;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defun cached-execute (connection-id script)
|
||||
"Excute SCRIPT on browser, if connection cache enabled use. (Private)"
|
||||
(if *connection-cache*
|
||||
(push script *connection-cache*)
|
||||
(clog-connection:execute connection-id script)))
|
||||
|
||||
;;;;;;;;;;;;;;;;
|
||||
;; js-execute ;;
|
||||
;;;;;;;;;;;;;;;;
|
||||
|
|
@ -93,9 +103,7 @@ during attachment. (Private)"))
|
|||
discarded, return CLOG-OBJ. (Internal)"))
|
||||
|
||||
(defmethod js-execute ((obj clog-obj) script)
|
||||
(if *connection-cache*
|
||||
(push script *connection-cache*)
|
||||
(clog-connection:execute (connection-id obj) script))
|
||||
(cached-execute (connection-id obj) script)
|
||||
obj)
|
||||
|
||||
;;;;;;;;;;;;;;
|
||||
|
|
|
|||
|
|
@ -49,8 +49,7 @@ clog array but is not in the DOM. If HTML-ID is nil one is generated.
|
|||
(let ((web-id (if html-id
|
||||
html-id
|
||||
(format nil "CLOG~A" (generate-id)))))
|
||||
(clog-connection:execute
|
||||
connection-id
|
||||
(cached-execute connection-id
|
||||
(format nil
|
||||
"clog['~A']=$(\"~A\").get(0); $(clog['~A']).first().prop('id','~A')"
|
||||
web-id html web-id web-id))
|
||||
|
|
@ -63,7 +62,7 @@ clog array but is not in the DOM. If HTML-ID is nil one is generated.
|
|||
(defun attach (connection-id html-id)
|
||||
"Create a new clog-obj and attach an existing element with HTML-ID on
|
||||
CONNECTION-ID to it and then return it. The HTML-ID must be unique. (private)"
|
||||
(clog-connection:execute connection-id
|
||||
(cached-execute connection-id
|
||||
(format nil "clog['~A']=$('#~A').get(0)" html-id html-id))
|
||||
(make-clog-element connection-id html-id))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue