forked from akopachov/flipper-zero_authenticator-companion
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
140 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
const { ipcMain } = require('electron'); | ||
|
||
module.exports.rpcHandle = function(mainWindowProvider, name, handler) { | ||
module.exports.rpcHandle = function (mainWindowProvider, name, handler) { | ||
ipcMain.on(name, async (_, request) => { | ||
const result = await handler(request.arg); | ||
mainWindowProvider().webContents.send(`${name}:done`, { requestId: request.requestId, result }); | ||
}); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
console.log('Preload'); | ||
console.log('Preload'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { TotpAppClient } from "$lib/totp-client"; | ||
import { readable } from "svelte/store"; | ||
import { TotpAppClient } from '$lib/totp-client'; | ||
import { readable } from 'svelte/store'; | ||
|
||
export const SharedTotpAppClient = readable(new TotpAppClient()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,18 @@ | ||
import { getContext, hasContext, setContext } from "svelte"; | ||
import { readable, writable } from "svelte/store"; | ||
import { getContext, hasContext, setContext } from 'svelte'; | ||
import { readable, writable } from 'svelte/store'; | ||
|
||
// context for any type of store | ||
export const useSharedStore = <T, A>( | ||
name: string, | ||
fn: (value?: A) => T, | ||
defaultValue?: A, | ||
) => { | ||
if (hasContext(name)) { | ||
return getContext<T>(name); | ||
} | ||
const _value = fn(defaultValue); | ||
setContext(name, _value); | ||
return _value; | ||
export const useSharedStore = <T, A>(name: string, fn: (value?: A) => T, defaultValue?: A) => { | ||
if (hasContext(name)) { | ||
return getContext<T>(name); | ||
} | ||
const _value = fn(defaultValue); | ||
setContext(name, _value); | ||
return _value; | ||
}; | ||
|
||
// writable store context | ||
export const useWritable = <T>(name: string, value: T) => | ||
useSharedStore(name, writable, value); | ||
export const useWritable = <T>(name: string, value: T) => useSharedStore(name, writable, value); | ||
|
||
// readable store context | ||
export const useReadable = <T>(name: string, value: T) => | ||
useSharedStore(name, readable, value); | ||
export const useReadable = <T>(name: string, value: T) => useSharedStore(name, readable, value); |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters