mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-15 09:04:04 +02:00
17 lines
720 B
TypeScript
17 lines
720 B
TypeScript
import { useEffect } from 'react';
|
|
|
|
// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied
|
|
export default function(postMessage: Function, isReady: boolean, scripts: string[], cssFilePath: string) {
|
|
useEffect(() => {
|
|
if (!isReady) return;
|
|
postMessage('setScripts', { scripts: scripts });
|
|
// eslint-disable-next-line @seiyab/react-hooks/exhaustive-deps -- Old code before rule was applied
|
|
}, [scripts, isReady]);
|
|
|
|
useEffect(() => {
|
|
if (!isReady || !cssFilePath) return;
|
|
postMessage('setScript', { script: cssFilePath, key: 'themeCss' });
|
|
// eslint-disable-next-line @seiyab/react-hooks/exhaustive-deps -- Old code before rule was applied
|
|
}, [isReady, cssFilePath]);
|
|
}
|