import React, { Children } from 'react' import { execute } from '../../../../../electron/core/plugin-manager/execution/extension-manager' type Props = { pluginName: string preferenceValues: any preferenceItems: any } import { formatPluginsName } from '@utils/converter' import { PluginService, preferences } from '@janhq/core' const PreferencePlugins = (props: Props) => { const { pluginName, preferenceValues, preferenceItems } = props /** * Notifies plugins of a preference update by executing the `PluginService.OnPreferencesUpdate` event. * If a timeout is already set, it is cleared before setting a new timeout to execute the event. */ let timeout: any | undefined = undefined function notifyPreferenceUpdate() { if (timeout) { clearTimeout(timeout) } timeout = setTimeout(() => execute(PluginService.OnPreferencesUpdate), 100) } return (