Skip to content

Commit

Permalink
Merge branch 'develop' into upkeep/use-is-plugin-active
Browse files Browse the repository at this point in the history
  • Loading branch information
Sidsector9 authored Mar 1, 2024
2 parents 5d545dd + 8112649 commit 1865da5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions hooks/use-script/index.js → hooks/use-script/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import { useEffect, useRef, useState } from '@wordpress/element';
* @param {string} scriptSource Source URL of the script to be loaded.
* @returns {HTMLScriptElement} The script tag.
*/
export const useScript = (scriptSource) => {
const scriptElement = useRef();
const [scriptLoaded, setScriptLoaded] = useState(false);
export const useScript = (scriptSource: string): { hasLoaded: boolean, scriptElement: HTMLScriptElement | null } => {
const scriptElement = useRef<HTMLScriptElement | null>(null);
const [scriptLoaded, setScriptLoaded] = useState<boolean>(false);

useEffect(() => {
if (window) {
Expand Down

0 comments on commit 1865da5

Please sign in to comment.