2020-11-16 18:14:26 +02:00
|
|
|
import { useEffect } from 'react';
|
|
|
|
|
2023-06-30 11:30:29 +02:00
|
|
|
// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied
|
2020-11-16 18:14:26 +02:00
|
|
|
export default function(postMessage: Function, isReady: boolean, scripts: string[], cssFilePath: string) {
|
|
|
|
useEffect(() => {
|
|
|
|
if (!isReady) return;
|
|
|
|
postMessage('setScripts', { scripts: scripts });
|
2022-08-19 13:10:04 +02:00
|
|
|
// eslint-disable-next-line @seiyab/react-hooks/exhaustive-deps -- Old code before rule was applied
|
2020-11-16 18:14:26 +02:00
|
|
|
}, [scripts, isReady]);
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
if (!isReady || !cssFilePath) return;
|
|
|
|
postMessage('setScript', { script: cssFilePath, key: 'themeCss' });
|
2022-08-19 13:10:04 +02:00
|
|
|
// eslint-disable-next-line @seiyab/react-hooks/exhaustive-deps -- Old code before rule was applied
|
2020-11-16 18:14:26 +02:00
|
|
|
}, [isReady, cssFilePath]);
|
|
|
|
}
|