mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-20 04:21:25 +02:00
style: auto-format codebase with Prettier
Applied formatting to 1487+ files using pnpm format:write - TypeScript/JavaScript files - Svelte components - Astro pages - JSON configs - Markdown docs 13 files still need manual review (Astro JSX comments)
This commit is contained in:
parent
0241f5554c
commit
d36b321d9d
3952 changed files with 661498 additions and 739751 deletions
|
|
@ -6,50 +6,50 @@ let networkAdapter: NetworkAdapter | null = null;
|
|||
* Set the network adapter for the auth service
|
||||
*/
|
||||
export function setNetworkAdapter(adapter: NetworkAdapter): void {
|
||||
networkAdapter = adapter;
|
||||
networkAdapter = adapter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current network adapter
|
||||
*/
|
||||
export function getNetworkAdapter(): NetworkAdapter | null {
|
||||
return networkAdapter;
|
||||
return networkAdapter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if device is connected to the network
|
||||
*/
|
||||
export async function isDeviceConnected(): Promise<boolean> {
|
||||
if (!networkAdapter) {
|
||||
// Default to true if no adapter is set
|
||||
return true;
|
||||
}
|
||||
return networkAdapter.isDeviceConnected();
|
||||
if (!networkAdapter) {
|
||||
// Default to true if no adapter is set
|
||||
return true;
|
||||
}
|
||||
return networkAdapter.isDeviceConnected();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if device has a stable connection
|
||||
*/
|
||||
export async function hasStableConnection(): Promise<boolean> {
|
||||
if (!networkAdapter || !networkAdapter.hasStableConnection) {
|
||||
// Default to basic connectivity check
|
||||
return isDeviceConnected();
|
||||
}
|
||||
return networkAdapter.hasStableConnection();
|
||||
if (!networkAdapter || !networkAdapter.hasStableConnection) {
|
||||
// Default to basic connectivity check
|
||||
return isDeviceConnected();
|
||||
}
|
||||
return networkAdapter.hasStableConnection();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a web-based network adapter
|
||||
*/
|
||||
export function createWebNetworkAdapter(): NetworkAdapter {
|
||||
return {
|
||||
async isDeviceConnected(): Promise<boolean> {
|
||||
return navigator.onLine;
|
||||
},
|
||||
async hasStableConnection(): Promise<boolean> {
|
||||
// For web, we just check online status
|
||||
// More sophisticated checks could be added
|
||||
return navigator.onLine;
|
||||
},
|
||||
};
|
||||
return {
|
||||
async isDeviceConnected(): Promise<boolean> {
|
||||
return navigator.onLine;
|
||||
},
|
||||
async hasStableConnection(): Promise<boolean> {
|
||||
// For web, we just check online status
|
||||
// More sophisticated checks could be added
|
||||
return navigator.onLine;
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue