global-input-react
Advanced tools
Comparing version 4.5.1 to 4.6.0
@@ -128,4 +128,4 @@ "use strict"; | ||
mobileApp.con.disconnect(); | ||
deviceApp.hook.result.current.disconnect(); | ||
deviceApp.hook.result.current.close(); | ||
deviceApp.hook.unmount(); | ||
}, 10000); |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.keepConnection = exports.reducer = exports.startConnect = exports.sendInitData = exports.isValidInitData = exports.sendValue = exports.disconnect = exports.initialState = void 0; | ||
exports.keepConnection = exports.reducer = exports.startConnect = exports.sendInitData = exports.isValidInitData = exports.sendValue = exports.closeConnection = exports.initialState = void 0; | ||
@@ -26,3 +26,3 @@ var _globalInputMessage = require("global-input-message"); | ||
INITIALIZING: 1, | ||
DISCONNECTED: 2, | ||
CLOSED: 2, | ||
ERROR: 3, | ||
@@ -40,5 +40,6 @@ WAITING_FOR_MOBILE: 4, | ||
isError: false, | ||
isDisconnected: false, | ||
isClosed: false, | ||
isConnected: false, | ||
isConnectionDenied: false, | ||
isDisconnected: false, | ||
initData: null, | ||
@@ -65,3 +66,3 @@ connected: [] | ||
const closeConnection = () => { | ||
const closeConnection = notify => { | ||
if (mobileData.session) { | ||
@@ -76,7 +77,4 @@ mobileData.session.disconnect(); | ||
} | ||
}; | ||
const disconnect = notify => { | ||
closeConnection(); | ||
mobileData.mobileState = MobileState.DISCONNECTED; | ||
mobileData.mobileState = MobileState.CLOSED; | ||
@@ -90,3 +88,3 @@ if (notify) { | ||
exports.disconnect = disconnect; | ||
exports.closeConnection = closeConnection; | ||
@@ -421,6 +419,8 @@ const sendValue = (fieldId, valueToSet, fieldIndex = -1) => { | ||
isError: mobileData.mobileState === MobileState.ERROR, | ||
isDisconnected: mobileData.mobileState === MobileState.DISCONNECTED, | ||
isClosed: mobileData.mobileState === MobileState.CLOSED, | ||
isConnected: mobileData.mobileState === MobileState.MOBILE_CONNECTED, | ||
isDisconnected: !!mobileData.sender && mobileData.mobileState !== MobileState.MOBILE_CONNECTED, | ||
initData: mobileData.mobileConfig && mobileData.mobileConfig.initData, | ||
senders: mobileData.senders | ||
senders: mobileData.senders, | ||
sender: mobileData.sender | ||
}; | ||
@@ -427,0 +427,0 @@ }; |
@@ -25,7 +25,9 @@ "use strict"; | ||
isError, | ||
isClosed, | ||
isConnected, | ||
isDisconnected, | ||
isConnected, | ||
isConnectionDenied, | ||
initData, | ||
senders | ||
senders, | ||
sender | ||
}, dispatch] = (0, _react.useReducer)(globalInput.reducer, globalInput.initialState); | ||
@@ -87,3 +89,3 @@ const attached = (0, _react.useRef)(true); | ||
globalInput.disconnect(notify); | ||
globalInput.closeConnection(notify); | ||
globalInput.startConnect(config ? config : configRef.current, notify); | ||
@@ -107,4 +109,4 @@ }, []); | ||
}, []); | ||
const disconnect = (0, _react.useCallback)(() => { | ||
globalInput.disconnect(notify); | ||
const close = (0, _react.useCallback)(() => { | ||
globalInput.closeConnection(notify); | ||
}, []); | ||
@@ -132,11 +134,13 @@ const sendValue = globalInput.sendValue; | ||
isError, | ||
isClosed, | ||
isConnected, | ||
isDisconnected, | ||
isConnected, | ||
isConnectionDenied, | ||
initData, | ||
senders, | ||
sender, | ||
sendValue, | ||
sendInitData, | ||
setOnchange, | ||
disconnect, | ||
close, | ||
restart | ||
@@ -143,0 +147,0 @@ }; |
import React from 'react'; | ||
import { InitData, FormField, FieldValue, Sender } from 'global-input-message'; | ||
export * from 'global-input-message'; | ||
import type { InitData, FormField, FieldValue, Sender } from 'global-input-message'; | ||
export type * from 'global-input-message'; | ||
export function useGlobalInputApp(config: ConfigData | (() => ConfigData), canConnect?: boolean, configId?: any): GlobalInputData; | ||
@@ -11,3 +11,3 @@ export function getGlobalInputState(): GlobalInputState; | ||
isError: boolean; | ||
isDisconnected: boolean; | ||
isClosed: boolean; | ||
isConnected: boolean; | ||
@@ -66,11 +66,13 @@ isConnectionDenied: boolean; | ||
isError: boolean; | ||
isDisconnected: boolean; | ||
isClosed: boolean; | ||
isConnected: boolean; | ||
isDisconnected:boolean; | ||
isConnectionDenied: boolean; | ||
initData: InitData; | ||
senders: Sender[]; | ||
sender:Sender; | ||
sendValue: SendValueFunction; | ||
sendInitData: SendInitDataFunction; | ||
setOnchange: (onchange: OnchangeFunction) => void; | ||
disconnect: () => void; | ||
close: () => void; | ||
restart: (config?: ConfigData) => void; | ||
@@ -77,0 +79,0 @@ } |
{ | ||
"name": "global-input-react", | ||
"version": "4.5.1", | ||
"version": "4.6.0", | ||
"description": "global input react component", | ||
@@ -75,2 +75,2 @@ "main": "./dist/index", | ||
} | ||
} | ||
} |
@@ -20,3 +20,3 @@ | ||
INITIALIZING: 1, | ||
DISCONNECTED: 2, | ||
CLOSED: 2, | ||
ERROR: 3, | ||
@@ -35,5 +35,6 @@ WAITING_FOR_MOBILE: 4, | ||
isError: false, | ||
isDisconnected: false, | ||
isClosed: false, | ||
isConnected: false, | ||
isConnectionDenied: false, | ||
isDisconnected: false, | ||
initData: null, | ||
@@ -62,3 +63,4 @@ connected: [] | ||
const closeConnection = () => { | ||
export const closeConnection = (notify) => { | ||
if (mobileData.session) { | ||
@@ -73,6 +75,3 @@ mobileData.session.disconnect(); | ||
} | ||
}; | ||
export const disconnect = (notify) => { | ||
closeConnection(); | ||
mobileData.mobileState = MobileState.DISCONNECTED; | ||
mobileData.mobileState = MobileState.CLOSED; | ||
if (notify) { | ||
@@ -319,6 +318,8 @@ notify({ type: ACTION_TYPES.CLOSE }); | ||
isError: mobileData.mobileState === MobileState.ERROR, | ||
isDisconnected: mobileData.mobileState === MobileState.DISCONNECTED, | ||
isClosed: mobileData.mobileState === MobileState.CLOSED, | ||
isConnected: mobileData.mobileState === MobileState.MOBILE_CONNECTED, | ||
isDisconnected: (!!mobileData.sender) && (mobileData.mobileState !== MobileState.MOBILE_CONNECTED), | ||
initData: mobileData.mobileConfig && mobileData.mobileConfig.initData, | ||
senders: mobileData.senders | ||
senders: mobileData.senders, | ||
sender: mobileData.sender | ||
} | ||
@@ -325,0 +326,0 @@ } |
@@ -12,7 +12,9 @@ import * as globalInput from './globalinput'; | ||
isError, | ||
isClosed, | ||
isConnected, | ||
isDisconnected, | ||
isConnected, | ||
isConnectionDenied, | ||
initData, | ||
senders | ||
senders, | ||
sender | ||
}, dispatch] = useReducer(globalInput.reducer, globalInput.initialState); | ||
@@ -66,3 +68,3 @@ | ||
} | ||
globalInput.disconnect(notify); | ||
globalInput.closeConnection(notify); | ||
globalInput.startConnect(config ? config : configRef.current, notify); | ||
@@ -87,4 +89,4 @@ }, []) | ||
const disconnect = useCallback(() => { | ||
globalInput.disconnect(notify); | ||
const close = useCallback(() => { | ||
globalInput.closeConnection(notify); | ||
}, []); | ||
@@ -119,13 +121,15 @@ | ||
isError, | ||
isClosed, | ||
isConnected, | ||
isDisconnected, | ||
isConnected, | ||
isConnectionDenied, | ||
initData, | ||
senders, | ||
sender, | ||
sendValue, | ||
sendInitData, | ||
setOnchange, | ||
disconnect, | ||
close, | ||
restart, | ||
}; | ||
}; |
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
1255289
37569