Skip to content

Instantly share code, notes, and snippets.

View spotsccc's full-sized avatar
🎯
Focusing

Chernenko Ivan spotsccc

🎯
Focusing
View GitHub Profile
import { context, Fn, noop, top, wrap } from '@reatom/core';
function takeNested(cb: Fn) {
const frame = top();
return new Promise<void>((resolve, reject) => {
let i = 1;
const check = () => {
import { action, atom, Atom, AtomState, withInit } from '@reatom/framework';
import { routerAtom } from 'shared/lib/router';
const isPending = atom(false, 'isPending');
const queue = atom<Array<() => Promise<void>>>([], 'queue');
isPending.onChange((ctx, isPendingValue) => {
const queueValue = ctx.get(queue);
if (!isPendingValue && queueValue.length > 0) {
const update = queueValue[0];
export type SuggestItem = {
id: string;
name: string;
};
export type SuggestResource = {
suggestsAtom: Atom<Array<SuggestItem>>;
loadingAtom: Atom<boolean>;
errorAtom: Atom<Error | undefined>;
changeSuggestQueryParam: Action<[string]>;
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract ENS {
struct Domain {
address addr;
uint expiresAt;
uint price;
}
@spotsccc
spotsccc / bind-query-param.ts
Created September 22, 2024 16:59
Vue bind query params
import { ref, watch, type Ref } from 'vue'
import { useRoute, useRouter, type LocationQueryValue } from 'vue-router'
const isPending = ref(false)
const queue = ref<Array<() => void>>([])
export function bind(v: Ref<LocationQueryValue | Array<LocationQueryValue>>, name: string) {
const router = useRouter()
const route = useRoute()