global-input-react
Advanced tools
Comparing version 4.5.0 to 4.5.1
@@ -6,5 +6,2 @@ "use strict"; | ||
}); | ||
var _exportNames = { | ||
useGlobalInputApp: true | ||
}; | ||
exports.useGlobalInputApp = void 0; | ||
@@ -16,16 +13,2 @@ | ||
var _globalInputMessage = require("global-input-message"); | ||
Object.keys(_globalInputMessage).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | ||
if (key in exports && exports[key] === _globalInputMessage[key]) return; | ||
Object.defineProperty(exports, key, { | ||
enumerable: true, | ||
get: function () { | ||
return _globalInputMessage[key]; | ||
} | ||
}); | ||
}); | ||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; } | ||
@@ -91,2 +74,16 @@ | ||
if (config && typeof config.initData === 'function') { | ||
config.initData = config.initData(); | ||
} | ||
if (!config) { | ||
if (typeof configRef.current === 'function') { | ||
configRef.current = configRef.current(); | ||
} | ||
if (typeof configRef.current.initData === 'function') { | ||
configRef.current.initData = configRef.current.initData(); | ||
} | ||
} | ||
globalInput.disconnect(notify); | ||
@@ -93,0 +90,0 @@ globalInput.startConnect(config ? config : configRef.current, notify); |
{ | ||
"name": "global-input-react", | ||
"version": "4.5.0", | ||
"version": "4.5.1", | ||
"description": "global input react component", | ||
@@ -75,2 +75,2 @@ "main": "./dist/index", | ||
} | ||
} | ||
} |
import * as globalInput from './globalinput'; | ||
import { useReducer, useRef, useEffect, useCallback } from "react"; | ||
export * from 'global-input-message'; | ||
export const useGlobalInputApp = (config, canConnect = true, configId = "") => { | ||
@@ -55,2 +54,13 @@ const [{ | ||
} | ||
if (config && typeof config.initData === 'function') { | ||
config.initData = config.initData(); | ||
} | ||
if (!config) { | ||
if (typeof configRef.current === 'function') { | ||
configRef.current = configRef.current(); | ||
} | ||
if (typeof configRef.current.initData === 'function') { | ||
configRef.current.initData = configRef.current.initData(); | ||
} | ||
} | ||
globalInput.disconnect(notify); | ||
@@ -57,0 +67,0 @@ globalInput.startConnect(config ? config : configRef.current, notify); |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1254815
37555