File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 744744 :style $ {} ( :padding "|0 12px 12px 12px" )
745745 div
746746 {} $ :class-name ( str-spaced css/row-parted )
747- a $ {} ( :class-name style-clear ) ( :inner-text |Export )
748- :on-click $ fn ( e d! ) ( tab-echo! sessions :edn )
747+ div
748+ {} $ :class-name ( str-spaced css/row css/gap8 )
749+ a $ {} ( :class-name style-clear ) ( :inner-text |Data )
750+ :on-click $ fn ( e d! ) ( tab-echo! sessions :edn )
751+ a $ {} ( :class-name style-clear ) ( :inner-text |Download )
752+ :on-click $ fn ( e d! ) ( download-sessions! sessions )
749753 if
750754 > ( count sessions ) 0
751755 a $ {} ( :class-name style-clear ) ( :inner-text "|Clear all" )
779783 .!slice first-msg 0 end
780784 :is-history? false
781785 :examples $ []
786+ |download-sessions! $ %{} :CodeEntry ( :doc | ) ( :schema nil )
787+ :code $ quote
788+ defn download-sessions! ( sessions )
789+ let
790+ content $ format-cirru-edn sessions
791+ blob $ new js/Blob ( js-array content )
792+ js-object $ :type |application/edn;charset=utf-8
793+ url $ js/URL.createObjectURL blob
794+ link $ js/document.createElement |a
795+ filename $ str |sessions- ( js/Date.now ) |.cirru
796+ do ( .!setAttribute link |href url ) ( .!setAttribute link |download filename ) ( .!appendChild js/document.body link ) ( .!click link ) ( .!remove link )
797+ js/setTimeout
798+ fn () $ js/URL.revokeObjectURL url
799+ , 0
800+ :examples $ []
782801 |effect-focus $ %{} :CodeEntry ( :doc | ) ( :schema nil )
783802 :code $ quote
784803 defeffect effect-focus () ( action el at? )
You can’t perform that action at this time.
0 commit comments