@schedule-x/react
Advanced tools
Comparing version 2.14.0 to 2.14.1
@@ -65,7 +65,8 @@ 'use strict'; | ||
const usePlugin = (plugin) => { | ||
if ('undefined' === typeof window) { | ||
throw new Error('usePlugin can only be used in the browser. You need to wrap all logic for the calendar in a client side component.'); | ||
} | ||
const [pluginInstance, setPluginInstance] = react.useState(); | ||
react.useEffect(() => { | ||
if (typeof window !== 'undefined') { | ||
setPluginInstance(plugin); | ||
} | ||
setPluginInstance(plugin); | ||
}, []); | ||
@@ -72,0 +73,0 @@ return pluginInstance; |
@@ -63,7 +63,8 @@ import { jsx, Fragment, jsxs } from 'react/jsx-runtime'; | ||
const usePlugin = (plugin) => { | ||
if ('undefined' === typeof window) { | ||
throw new Error('usePlugin can only be used in the browser. You need to wrap all logic for the calendar in a client side component.'); | ||
} | ||
const [pluginInstance, setPluginInstance] = useState(); | ||
useEffect(() => { | ||
if (typeof window !== 'undefined') { | ||
setPluginInstance(plugin); | ||
} | ||
setPluginInstance(plugin); | ||
}, []); | ||
@@ -70,0 +71,0 @@ return pluginInstance; |
import { PluginBase } from '@schedule-x/shared'; | ||
export declare const usePlugin: <Plugin extends PluginBase<string>>(plugin: Plugin) => Plugin | undefined; | ||
export declare const usePlugin: <Plugin extends PluginBase<string>>(plugin: Plugin) => Plugin; |
@@ -18,3 +18,3 @@ { | ||
"types": "dist/types/index.d.ts", | ||
"version": "2.14.0", | ||
"version": "2.14.1", | ||
"type": "module", | ||
@@ -21,0 +21,0 @@ "files": [ |
Sorry, the diff of this file is not supported yet
15103
253