1- const $$ = {
1+ export const $$ = {
22 on ( root , eventName , selector , fn ) {
33 root . removeEventListener ( eventName , fn ) ;
44 root . addEventListener ( eventName , ( event ) => {
@@ -70,7 +70,7 @@ const $$ = {
7070 } ,
7171} ;
7272
73- async function ajax ( url , init ) {
73+ export async function ajax ( url , init ) {
7474 try {
7575 const response = await fetch ( url , {
7676 credentials : "same-origin" ,
@@ -94,7 +94,7 @@ async function ajax(url, init) {
9494 }
9595}
9696
97- function ajaxForm ( element ) {
97+ export function ajaxForm ( element ) {
9898 const form = element . closest ( "form" ) ;
9999 const url = new URL ( form . action ) ;
100100 const formData = new FormData ( form ) ;
@@ -107,7 +107,7 @@ function ajaxForm(element) {
107107 return ajax ( url , ajaxData ) ;
108108}
109109
110- function replaceToolbarState ( newRequestId , data ) {
110+ export function replaceToolbarState ( newRequestId , data ) {
111111 const djDebug = document . getElementById ( "djDebug" ) ;
112112 djDebug . setAttribute ( "data-request-id" , newRequestId ) ;
113113 // Check if response is empty, it could be due to an expired requestId.
@@ -121,7 +121,7 @@ function replaceToolbarState(newRequestId, data) {
121121 }
122122}
123123
124- function debounce ( func , delay ) {
124+ export function debounce ( func , delay ) {
125125 let timer = null ;
126126 let resolves = [ ] ;
127127
@@ -138,5 +138,3 @@ function debounce(func, delay) {
138138 return await new Promise ( ( r ) => resolves . push ( r ) ) ;
139139 } ;
140140}
141-
142- export { $$ , ajax , ajaxForm , debounce , replaceToolbarState } ;
0 commit comments