Revert changes to poll
This commit is contained in:
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@welshman",
|
||||
"private": true,
|
||||
"version": "0.8.11",
|
||||
"version": "0.8.12",
|
||||
"workspaces": [
|
||||
"packages/*"
|
||||
],
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@welshman/app",
|
||||
"version": "0.8.11",
|
||||
"version": "0.8.12",
|
||||
"author": "hodlbod",
|
||||
"license": "MIT",
|
||||
"description": "A collection of svelte stores for use in building nostr client applications.",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@welshman/content",
|
||||
"version": "0.8.11",
|
||||
"version": "0.8.12",
|
||||
"author": "hodlbod",
|
||||
"license": "MIT",
|
||||
"description": "A collection of utilities for parsing nostr note content.",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@welshman/editor",
|
||||
"version": "0.8.11",
|
||||
"version": "0.8.12",
|
||||
"author": "hodlbod",
|
||||
"license": "MIT",
|
||||
"description": "A batteries-included nostr editor.",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@welshman/feeds",
|
||||
"version": "0.8.11",
|
||||
"version": "0.8.12",
|
||||
"author": "hodlbod",
|
||||
"license": "MIT",
|
||||
"description": "Utilities for building dynamic nostr feeds.",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@welshman/lib",
|
||||
"version": "0.8.11",
|
||||
"version": "0.8.12",
|
||||
"author": "hodlbod",
|
||||
"license": "MIT",
|
||||
"description": "A collection of utilities.",
|
||||
|
||||
@@ -1150,9 +1150,9 @@ export const randomId = (): string => Math.random().toString().slice(2)
|
||||
*/
|
||||
export const sleep = (t: number) => new Promise(resolve => setTimeout(resolve, t))
|
||||
|
||||
export type PollOptions<T> = {
|
||||
export type PollOptions = {
|
||||
signal: AbortSignal
|
||||
condition: () => T
|
||||
condition: () => unknown
|
||||
interval?: number
|
||||
}
|
||||
|
||||
@@ -1161,21 +1161,17 @@ export type PollOptions<T> = {
|
||||
* @param options - PollOptions
|
||||
* @returns void Promise
|
||||
*/
|
||||
export const poll = <T>({interval = 300, condition, signal}: PollOptions<T>) =>
|
||||
new Promise<T | void>(resolve => {
|
||||
export const poll = ({interval = 300, condition, signal}: PollOptions) =>
|
||||
new Promise<void>(resolve => {
|
||||
const int = setInterval(() => {
|
||||
const value = condition()
|
||||
|
||||
if (value !== undefined) {
|
||||
resolve(value)
|
||||
if (condition()) {
|
||||
resolve()
|
||||
clearInterval(int)
|
||||
}
|
||||
}, interval)
|
||||
|
||||
const value = condition()
|
||||
|
||||
if (value !== undefined) {
|
||||
resolve(value)
|
||||
if (condition()) {
|
||||
resolve()
|
||||
clearInterval(int)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@welshman/net",
|
||||
"version": "0.8.11",
|
||||
"version": "0.8.12",
|
||||
"author": "hodlbod",
|
||||
"license": "MIT",
|
||||
"description": "Utilities for connecting with nostr relays.",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@welshman/router",
|
||||
"version": "0.8.11",
|
||||
"version": "0.8.12",
|
||||
"author": "hodlbod",
|
||||
"license": "MIT",
|
||||
"description": "A collection of utilities for nostr relay selection.",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@welshman/signer",
|
||||
"version": "0.8.11",
|
||||
"version": "0.8.12",
|
||||
"author": "hodlbod",
|
||||
"license": "MIT",
|
||||
"description": "A nostr signer implemenation supporting several login methods.",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@welshman/store",
|
||||
"version": "0.8.11",
|
||||
"version": "0.8.12",
|
||||
"author": "hodlbod",
|
||||
"license": "MIT",
|
||||
"description": "A collection of utilities based on svelte/store for use with welshman",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@welshman/util",
|
||||
"version": "0.8.11",
|
||||
"version": "0.8.12",
|
||||
"author": "hodlbod",
|
||||
"license": "MIT",
|
||||
"description": "A collection of nostr-related utilities.",
|
||||
|
||||
Reference in New Issue
Block a user