INNER CODE UNIT · TypeScript
addEventListener
react-native-netinfo/react-native-netinfo · src/index.ts:111
export function addEventListener(
listener: Types.NetInfoChangeHandler,
): Types.NetInfoSubscription {
if (!_state) {
_state = createState();
}
_state.add(listener);
return (): void => {
_state && _state.remove(listener);
};
}
/**
* A React Hook into this library's singleton which updates when the connection state changes.
*
* @param {Partial<Types.NetInfoConfiguration>} configuration - Configure the isolated network checker managed by this hook
*