repo_name
stringlengths
5
122
path
stringlengths
3
232
text
stringlengths
6
1.05M
azakordonets/ts-retry
lib/esm/retry/utils/untilTruthy/retry.d.ts
import { RetryUtilsOptions } from "../options"; export declare function retryUntilTruthy<RETURN_TYPE>(fn: () => RETURN_TYPE, retryOptions?: RetryUtilsOptions): Promise<RETURN_TYPE>; export declare function retryAsyncUntilTruthy<RETURN_TYPE>(fn: () => Promise<RETURN_TYPE>, retryOptions?: RetryUtilsOptions): Promise<RETU...
azakordonets/ts-retry
src/wait/options.ts
export let defaultDuration = 60 * 1000; export function setDefaultDuration(duration: number) { defaultDuration = duration; } export function getDefaultDuration(): number { return defaultDuration; }
azakordonets/ts-retry
src/retry/utils/untilTruthy/index.ts
export { retryAsyncUntilTruthy, retryUntilTruthy } from "./retry"; export { retryAsyncUntilTruthyDecorator, retryUntilTruthyDecorator, } from "./decorator";
azakordonets/ts-retry
lib/esm/retry/options.d.ts
<reponame>azakordonets/ts-retry export declare type UNTIL<RETURN_TYPE> = (result: RETURN_TYPE) => boolean; export interface RetryOptions<RETURN_TYPE = any> { maxTry?: number; delay?: number; until?: UNTIL<RETURN_TYPE> | null; onMaxRetryFunc?: (err: Error) => void; } export declare let defaultRetryOption...
azakordonets/ts-retry
lib/esm/wait/options.d.ts
export declare let defaultDuration: number; export declare function setDefaultDuration(duration: number): void; export declare function getDefaultDuration(): number;
azakordonets/ts-retry
lib/esm/wait/decorators.d.ts
<gh_stars>10-100 export declare function waitUntilAsyncDecorator<RETURN_TYPE extends (...args: any[]) => Promise<any>>(fn: RETURN_TYPE, duration?: number, error?: Error): (...args: Parameters<RETURN_TYPE>) => ReturnType<RETURN_TYPE>; /** a waitUntil decorator * @param fn the function to execute * @param duration time...
azakordonets/ts-retry
src/retry/utils/untilTruthy/decorators.test.ts
import { retryAsyncUntilTruthyDecorator, retryUntilTruthyDecorator, } from "./decorator"; import * as sinon from "sinon"; import * as chai from "chai"; import * as sinonChai from "sinon-chai"; import { isTooManyTries } from "../../tooManyTries"; const should = require("chai").should(); chai.should(); chai.use(sino...
azakordonets/ts-retry
src/wait/decorators.test.ts
<filename>src/wait/decorators.test.ts import sinon = require("sinon"); import { waitUntilAsyncDecorator, waitUntilDecorator } from "./decorators"; describe("Wait decorators", function () { it("waitUntilAsyncDecorator should execute the function", async function () { const timeout = 100; const param = "Questi...
azakordonets/ts-retry
lib/esm/index.d.ts
<filename>lib/esm/index.d.ts<gh_stars>10-100 export type { RetryOptions } from "./retry"; export type { TooManyTries } from "./retry"; export { getDefaultRetryOptions, isTooManyTries, retry, retryAsync, retryAsyncUntilResponse, retryAsyncUntilResponseDecorator, retryAsyncUntilTruthy, retryAsyncUntilTruthyDecorator, ret...
azakordonets/ts-retry
src/retry/utils/untilDefined/decorators.test.ts
import { retryAsyncUntilDefinedDecorator, retryUntilDefinedDecorator, } from "./decorator"; import * as sinon from "sinon"; import * as chai from "chai"; import * as sinonChai from "sinon-chai"; import { isTooManyTries } from "../../tooManyTries"; const should = require("chai").should(); chai.should(); chai.use(si...
azakordonets/ts-retry
lib/esm/retry/utils/untilResponse/type.d.ts
<reponame>azakordonets/ts-retry export declare type RESPONSE_TYPE = { ok: boolean; };
azakordonets/ts-retry
src/wait/wait.test.ts
import { waitUntil } from ".."; import * as chai from "chai"; import * as sinonChai from "sinon-chai"; import { isTimeoutError } from "./wait"; import { getDefaultDuration, setDefaultDuration } from "./options"; import { setDefaultRetryOptions } from "../retry"; const should = require("chai").should(); chai.should(); ...
azakordonets/ts-retry
src/index.ts
<gh_stars>10-100 export type { RetryOptions } from "./retry"; export type { TooManyTries } from "./retry"; export { getDefaultRetryOptions, isTooManyTries, retry, retryAsync, retryAsyncUntilResponse, retryAsyncUntilResponseDecorator, retryAsyncUntilTruthy, retryAsyncUntilTruthyDecorator, retryUntilTr...
azakordonets/ts-retry
src/wait/wait.ts
<filename>src/wait/wait.ts import { asyncDecorator } from "../misc"; import { defaultDuration } from "./options"; export function wait(duration: number = defaultDuration) { return new Promise((resolve) => setTimeout(resolve, duration)); } export async function waitUntil<RETURN_TYPE>( fn: () => RETURN_TYPE, dura...
azakordonets/ts-retry
src/retry/utils/untilDefined/retry.ts
import { retry, retryAsync } from "../../retry"; import { retryUntilOptionsToRetryOptionsHof, RetryUtilsOptions, } from "../options"; const until = <RETURN_TYPE>( lastResult: RETURN_TYPE | undefined | null, ): boolean => lastResult !== undefined && lastResult !== null; const getOptions = retryUntilOptionsToRetr...
azakordonets/ts-retry
src/wait/options.test.ts
import * as chai from "chai"; import * as sinonChai from "sinon-chai"; import { getDefaultDuration, setDefaultDuration } from "../."; const should = require("chai").should(); chai.should(); chai.use(sinonChai); describe("wait option", function () { const defaultDuration = getDefaultDuration(); after(function () {...
azakordonets/ts-retry
lib/esm/retry/index.d.ts
<filename>lib/esm/retry/index.d.ts export type { RetryOptions } from "./options"; export { getDefaultRetryOptions, setDefaultRetryOptions } from "./options"; export { retry, retryAsync } from "./retry"; export { isTooManyTries } from "./tooManyTries"; export type { TooManyTries } from "./tooManyTries"; export type { Re...
azakordonets/ts-retry
lib/esm/retry/tooManyTries.d.ts
export declare class TooManyTries extends Error { constructor(); tooManyTries: boolean; } export declare function isTooManyTries(error: unknown): error is TooManyTries;
azakordonets/ts-retry
lib/esm/retry/utils/untilDefined/retry.d.ts
import { RetryUtilsOptions } from "../options"; export declare function retryUntilDefined<RETURN_TYPE>(fn: () => RETURN_TYPE | undefined | null, retryOptions?: RetryUtilsOptions): Promise<RETURN_TYPE>; export declare function retryAsyncUntilDefined<RETURN_TYPE>(fn: () => Promise<RETURN_TYPE | undefined | null>, retryOp...
azakordonets/ts-retry
src/retry/retry.test.ts
import * as sinon from "sinon"; import * as chai from "chai"; import * as sinonChai from "sinon-chai"; import { getDefaultRetryOptions, retry, RetryOptions, setDefaultRetryOptions, } from "."; import { isTooManyTries } from "./tooManyTries"; const should = require("chai").should(); chai.should(); chai.use(sino...
azakordonets/ts-retry
src/wait/index.ts
export { isTimeoutError, TimeoutError, wait, waitUntil, waitUntilAsync, } from "./wait"; export { getDefaultDuration, setDefaultDuration } from "./options";
azakordonets/ts-retry
src/retry/utils/untilResponse/retry.ts
<gh_stars>10-100 import { retry, retryAsync } from "../../retry"; import { retryUntilOptionsToRetryOptionsHof, RetryUtilsOptions, } from "../options"; import { RESPONSE_TYPE } from "./type"; const until = <RETURN_TYPE extends RESPONSE_TYPE>( lastResult: RETURN_TYPE, ): boolean => lastResult.ok; const getOptions...
azakordonets/ts-retry
src/retry/options.ts
export type UNTIL<RETURN_TYPE> = (result: RETURN_TYPE) => boolean; export interface RetryOptions<RETURN_TYPE = any> { maxTry?: number; delay?: number; until?: UNTIL<RETURN_TYPE> | null; onMaxRetryFunc?: (err: Error) => void; // this can be helpful when you want to save some information before throwing TooManyT...
azakordonets/ts-retry
src/retry/utils/options.ts
<filename>src/retry/utils/options.ts import { RetryOptions, UNTIL } from "../options"; export type RetryUtilsOptions = Exclude<RetryOptions<void>, "until">; export const retryUntilOptionsToRetryOptionsHof = <RETURN_TYPE>( until: UNTIL<RETURN_TYPE>, ) => ( retryOptions?: RetryUtilsOptions, ): RetryOptions<RE...
azakordonets/ts-retry
src/retry/option.test.ts
<filename>src/retry/option.test.ts import * as chai from "chai"; import * as sinonChai from "sinon-chai"; import { getDefaultRetryOptions, RetryOptions, setDefaultRetryOptions, } from "."; const should = require("chai").should(); chai.should(); chai.use(sinonChai); describe("RetryDefaultOption", function () { ...
azakordonets/ts-retry
src/retry/decorators.test.ts
import { retryAsyncDecorator, retryDecorator } from "./decorators"; import sinon = require("sinon"); import { isTooManyTries } from "./tooManyTries"; const should = require("chai").should(); describe("Retry decorator", function () { it("async decorator should return the valid result", async function () { const ...
azakordonets/ts-retry
src/retry/utils/untilTruthy/decorator.ts
<gh_stars>10-100 import { RetryUtilsOptions } from "../options"; import { retryAsyncUntilTruthy, retryUntilTruthy } from "./retry"; export function retryUntilTruthyDecorator< PARAMETERS_TYPE extends any[], RETURN_TYPE, >( fn: (...args: PARAMETERS_TYPE) => RETURN_TYPE, retryOptions?: RetryUtilsOptions, ) { re...
azakordonets/ts-retry
src/retry/utils/untilResponse/retry.test.ts
import { retryAsyncUntilResponse } from "./retry"; import * as sinon from "sinon"; import * as chai from "chai"; import * as sinonChai from "sinon-chai"; import { isTooManyTries } from "../../tooManyTries"; import { RESPONSE_TYPE } from "./type"; const should = require("chai").should(); chai.should(); chai.use(sinonCh...
azakordonets/ts-retry
lib/esm/retry/utils/index.d.ts
export { RetryUtilsOptions } from "./options"; export { retryAsyncUntilDefined, retryAsyncUntilDefinedDecorator, retryUntilDefined, retryUntilDefinedDecorator, } from "./untilDefined"; export { retryAsyncUntilTruthy, retryAsyncUntilTruthyDecorator, retryUntilTruthy, retryUntilTruthyDecorator, } from "./untilTruthy"; ex...
azakordonets/ts-retry
src/retry/tooManyTries.ts
<reponame>azakordonets/ts-retry export class TooManyTries extends Error { constructor() { super("function did not complete within allowed number of attempts"); } tooManyTries = true; } export function isTooManyTries(error: unknown): error is TooManyTries { return (error as TooManyTries).tooManyTries === tr...
azakordonets/ts-retry
src/retry/utils/untilTruthy/retry.test.ts
<gh_stars>10-100 import * as sinon from "sinon"; import * as chai from "chai"; import * as sinonChai from "sinon-chai"; import { isTooManyTries } from "../../tooManyTries"; import { retryAsyncUntilTruthy, retryUntilTruthy } from "./retry"; const should = require("chai").should(); chai.should(); chai.use(sinonChai); d...
azakordonets/ts-retry
src/retry/utils/untilResponse/decorators.ts
import { RetryUtilsOptions } from "../options"; import { retryAsyncUntilResponse } from "./retry"; import { RESPONSE_TYPE } from "./type"; export function retryAsyncUntilResponseDecorator< PARAMETERS_TYPE extends any[], RETURN_TYPE extends RESPONSE_TYPE, >( fn: (...args: PARAMETERS_TYPE) => Promise<RETURN_TYPE>,...
azakordonets/ts-retry
src/retry/tooManyTries.test.ts
<reponame>azakordonets/ts-retry import { isTooManyTries, TooManyTries } from "./tooManyTries"; describe("TooManyTries", function () { it("Should return false when error is not a ToManyTries", function () { const error = new Error("BOOM"); isTooManyTries(error).should.false; }); it("Should return true whe...
azakordonets/ts-retry
lib/esm/retry/utils/untilResponse/decorators.d.ts
import { RetryUtilsOptions } from "../options"; import { RESPONSE_TYPE } from "./type"; export declare function retryAsyncUntilResponseDecorator<PARAMETERS_TYPE extends any[], RETURN_TYPE extends RESPONSE_TYPE>(fn: (...args: PARAMETERS_TYPE) => Promise<RETURN_TYPE>, retryOptions?: RetryUtilsOptions): (...args: PARAMETE...
azakordonets/ts-retry
src/retry/index.ts
export type { RetryOptions } from "./options"; export { getDefaultRetryOptions, setDefaultRetryOptions } from "./options"; export { retry, retryAsync } from "./retry"; export { isTooManyTries } from "./tooManyTries"; export type { TooManyTries } from "./tooManyTries"; export type { RetryUtilsOptions } from "./utils"...
azakordonets/ts-retry
lib/esm/misc.d.ts
<gh_stars>10-100 export declare const asyncDecorator: <T>(fn: () => T) => () => Promise<T>; export declare const assertDefined: <T>(value: T | null | undefined, errMsg: string) => value is T;
azakordonets/ts-retry
src/retry/utils/untilDefined/decorator.ts
<gh_stars>10-100 import { RetryUtilsOptions } from "../options"; import { retryAsyncUntilDefined, retryUntilDefined } from "./retry"; export function retryUntilDefinedDecorator< PARAMETERS_TYPE extends any[], RETURN_TYPE, >( fn: (...args: PARAMETERS_TYPE) => RETURN_TYPE | null | undefined, retryOptions?: Retry...
azakordonets/ts-retry
lib/esm/retry/utils/options.d.ts
import { RetryOptions, UNTIL } from "../options"; export declare type RetryUtilsOptions = Exclude<RetryOptions<void>, "until">; export declare const retryUntilOptionsToRetryOptionsHof: <RETURN_TYPE>(until: UNTIL<RETURN_TYPE>) => (retryOptions?: RetryOptions<void> | undefined) => RetryOptions<RETURN_TYPE>;
azakordonets/ts-retry
lib/esm/retry/retry.d.ts
import { RetryOptions } from "./options"; export declare function retry<RETURN_TYPE>(fn: () => RETURN_TYPE, retryOptions?: RetryOptions<RETURN_TYPE>): Promise<RETURN_TYPE>; export declare function retryAsync<RETURN_TYPE>(fn: () => Promise<RETURN_TYPE>, retryOptions?: RetryOptions<RETURN_TYPE>): Promise<RETURN_TYPE>;
azakordonets/ts-retry
src/retry/utils/untilDefined/index.ts
<reponame>azakordonets/ts-retry export { retryAsyncUntilDefined, retryUntilDefined } from "./retry"; export { retryAsyncUntilDefinedDecorator, retryUntilDefinedDecorator, } from "./decorator";
urain39/ij2tpl.js
gh-page/main.ts
import { parse, setFilterMap } from '../ij2tpl'; setFilterMap({ toClass: function(type_) { let class_ = 'unknown'; if (type_ == 'directory') class_ = 'dir'; else if (type_ == 'file') class_ = 'file'; return class_; } }); const template = parse(`\ {{?contents.length}} <ul> {{?cont...
urain39/ij2tpl.js
ij2tpl.ts
<reponame>urain39/ij2tpl.js /** * @file IJ2TPL.js - A Lightweight Template Engine. * @version v0.1.3 * @author urain39 <<EMAIL>> * @copyright (c) 2018-2020 IJ2TPL.js / IJ2TPL.ts Authors. */ /* eslint-disable prefer-const */ export const version: string = '0.1.3'; /* eslint-disable no-unused-vars */ // FIXME: ^^...
alexandresantosm/clean-cache-control
src/data/usecases/index.ts
export * from "./load-purchases/local-load-purchases";
alexandresantosm/clean-cache-control
src/data/protocols/cache/cache-store.ts
<filename>src/data/protocols/cache/cache-store.ts export interface CacheStore { fetch: (key: string) => any; delete: (key: string) => void; insert: (key: string, value: any) => void; replace: (key: string, value: any) => void; }
alexandresantosm/clean-cache-control
src/domain/usecases/index.ts
<reponame>alexandresantosm/clean-cache-control export * from "./save-purchases"; export * from "./load-purchases";
alexandresantosm/clean-cache-control
src/data/usecases/load-purchases/local-load-purchases.ts
<gh_stars>0 import { CachePolicy, CacheStore } from "@/data/protocols/cache"; import { SavePurchases, LoadPurchases } from "@/domain/usecases"; export class LocalLoadPurchases implements SavePurchases, LoadPurchases { private readonly key = "purchases"; constructor( private readonly cacheStore: CacheStore, ...
alexandresantosm/clean-cache-control
src/data/protocols/cache/index.ts
<gh_stars>0 export * from "./cache-store"; export * from "./cache-policy";
alexandresantosm/clean-cache-control
src/data/usecases/load-purchases/local-load-purchases.spec.ts
import { LocalLoadPurchases } from "@/data/usecases"; import { CacheStoreSpy, mockPurchases, getCacheExpirationDate, } from "@/data/test"; type SutTypes = { sut: LocalLoadPurchases; cacheStore: CacheStoreSpy; }; const makeSut = (timestamp = new Date()): SutTypes => { const cacheStore = new CacheStoreSpy()...
alexandresantosm/clean-cache-control
src/data/test/index.ts
<filename>src/data/test/index.ts export * from "./mock-purchases"; export * from "./mock-cache";
alexandresantosm/clean-cache-control
src/domain/usecases/save-purchases.ts
import { PurchaseModel } from "@/domain/models"; export interface SavePurchases { save: (purchases: Array<SavePurchases.Params>) => Promise<void>; } export namespace SavePurchases { export type Params = PurchaseModel; }
alexandresantosm/clean-cache-control
src/domain/models/index.ts
export * from "./purchasesModel";
sofiyaca/NATURL
src/components/cart/Cart.tsx
<gh_stars>1-10 import React from "react"; import CartItem from "../cartItem/CartItem"; import "./Cart.scss"; import { Link } from "@reach/router"; export default function Cart({ handleClearCartClick, handleRemoveItemFromCartClick, onCheckoutClick, itemsInCart, totalCost, }) { return ( <div className="C...
sofiyaca/NATURL
src/components/cartItem/CartItem.tsx
<gh_stars>1-10 import React from "react"; import { CloseCircleOutlined } from "@ant-design/icons"; import "./CartItem.scss"; import { Link } from "@reach/router"; export default function CartItem({ itemId, thumbnail, name, cost, quantity, selectedColors, onRemoveItemFromCartClick, }) { const productPat...
davidtimovski/soccer-streamlined
lib/parser.ts
<filename>lib/parser.ts /// <reference path="match.ts" /> /// <reference path="stream.ts" /> class Parser { private static readonly kickOffTimeRegex: RegExp = /\[.+\]/; getMatchesFromPosts(posts: any[]): Match[] { let matches = new Array<Match>(); for (let post of posts) { let kickOffTime = this.ge...
davidtimovski/soccer-streamlined
lib/httpClient.ts
class HttpClient { get(url: string, successCallback: (result: any) => void, errorCallback: (statusCode: number) => void): void { let request = new XMLHttpRequest(); request.onreadystatechange = () => { if (request.readyState == 4) { if (request.status == 200) { successCal...
davidtimovski/soccer-streamlined
popup.ts
/// <reference path="./lib/app.ts" /> let httpClient = new HttpClient(); let httpError = () => { DomHelper.hideElement(DomHelper.loadingGif); DomHelper.showElement(DomHelper.soccerStreamsNote); }; function getData() { httpClient.get( 'https://soccerorigin.davidtimovski.com', (streamsOrigin) => { ...
radoslaw-medryk/react-template
src/components/ReactApp.tsx
<reponame>radoslaw-medryk/react-template<filename>src/components/ReactApp.tsx<gh_stars>0 import * as React from "react"; import { Hello } from "./Hello"; import { useConfig } from "@/src/config/useConfig"; export type ReactAppProps = { // }; export const ReactApp: React.SFC<ReactAppProps> = () => { const conf...
radoslaw-medryk/react-template
src/components/Hello.tsx
<reponame>radoslaw-medryk/react-template<filename>src/components/Hello.tsx import * as React from "react"; import { styled } from "linaria/react"; import { Rotor } from "./Rotor"; const HelloRotor = styled(Rotor)` background: papayawhip; height: 100vh; `; const HelloText = styled.h1` color: tomato; `; ex...
radoslaw-medryk/react-template
src/config/config.tsx
<gh_stars>0 import axios from "axios"; export type Config = { hello: string; }; const defaultConfig: Config = require("@/configs/dev-config.json"); export const configPromise = axios .get("/config.json") .then(response => { return response.data as Config; }) .catch(e => { console....
radoslaw-medryk/react-template
src/config/useConfig.tsx
import * as React from "react"; import { configPromise, Config } from "./config"; export function useConfig(): Config | undefined { const [config, setConfig] = React.useState<Config | undefined>(undefined); React.useEffect(() => { async function getConfigAsync() { const configResult = awai...
radoslaw-medryk/react-template
src/components/Rotor.tsx
import { styled } from "linaria/react"; export type RotorProps = { cycleTimeSec: number; }; // TODO [RM]: linaria passes all props down to div which gives React warning. export const Rotor = styled.div<RotorProps>` display: flex; flex-flow: row-nowrap; justify-content: center; align-items: center;...
martin-luo/MyUtils
util/debounceAndThrottle.ts
<filename>util/debounceAndThrottle.ts /** * This file contains the typescript version debouncing and throttling function. * * Acknowledgement: This code is borrowed from the util.js, which is in the same folder as this * file, and [Juejin.im](https://juejin.im/post/5c00f7fe51882516be2ee2fc) */ /** * @export * ...
martin-luo/MyUtils
util/ajax.ts
/** * The status of the XMLHttpRequest. * * @enum {number} */ enum XMLHttpRequestReadyState { NotInitialized, ServerConnectionEstablished, RequestReceived, ProcessingRequest, ResponseIsReady } const HTTP_STATUS_CODE_OK: number = 200; /** * @description This is an AJAX-like function, which is implemente...
donpark/ebml-stream
src/models/tags/Block.ts
import { EbmlDataTag } from "./EbmlDataTag"; import { BlockLacing } from "../enums/BlockLacing"; import { Tools } from "../../Tools"; import { EbmlTagId } from "../enums/EbmlTagId"; import { EbmlElementType } from "../enums/EbmlElementType"; export class Block extends EbmlDataTag { payload: Buffer; tra...
donpark/ebml-stream
test/tools.spec.ts
<filename>test/tools.spec.ts import assert from 'assert'; import { Tools as tools } from '../src/Tools'; import "jasmine"; describe('EBML', () => { describe('tools', () => { describe('#readVint()', () => { function readVint(buffer: Buffer, expected: number): void { const vint = tools.readVint(buffe...
donpark/ebml-stream
src/EbmlStreamDecoder.ts
import { Transform, TransformOptions, TransformCallback } from 'stream'; import { Tools as tools } from './Tools'; import { EbmlTag } from './models/EbmlTag'; import { EbmlElementType } from './models/enums/EbmlElementType'; import { EbmlTagPosition } from './models/enums/EbmlTagPosition'; import { EbmlTagFactory } fro...
DanxiongLei/Vimdroid
lib/device/android.ts
<reponame>DanxiongLei/Vimdroid /** * Created by ldx on 2017/4/7. */ import {DeviceBase, ProtocolBase, Resp} from "./base"; import {BaseError, SubcoreError} from "../util/error"; import logger from "../util/logger"; import {UIDevice, UserInterface} from "../user-interface"; import constants from "../constants"; import...
DanxiongLei/Vimdroid
lib/util/error.ts
/** * Created by ldx on 2017/4/8. */ import logger from "./logger"; import {strings} from "../res/string"; export class BaseError extends Error { constructor(msg?: string) { super(msg); Error.captureStackTrace(this, this.constructor); this.name = this.constructor.name; } public ...
DanxiongLei/Vimdroid
lib/ui-cli.ts
<filename>lib/ui-cli.ts /** * Created by ldx on 2017/4/9. */ import {strings} from "./res/string"; import logger from "./util/logger"; import {UserInterface, UIDevice} from "./user-interface"; import {AndroidCallback} from "./device/android"; import * as CLI from "./index"; import {Config} from "./index"; import {Bas...
DanxiongLei/Vimdroid
lib/index.ts
<filename>lib/index.ts<gh_stars>1-10 /** * Created by ldx on 2017/4/9. */ import {AndroidDevice, AndroidCallback} from "./device/android"; import * as keypress from "./io/keypress"; import {UserInterface} from "./user-interface"; import logger from "./util/logger"; import {Resp} from "./device/base"; export let andr...
DanxiongLei/Vimdroid
lib/res/string.ts
/** * Created by ldx on 2017/4/8. */ import {AndroidConnectError} from "../device/android"; import {BaseError, SubcoreError} from "../util/error"; export const strings = { error: { [SubcoreError.name]: { cause: "子程序错误.", solution: "" }, [AndroidConnectError.name]: ...
DanxiongLei/Vimdroid
lib/user-interface.ts
<filename>lib/user-interface.ts<gh_stars>1-10 /** * Created by ldx on 2017/4/8. */ export abstract class UserInterface { async abstract makeUserChoose(devices: UIDevice[]): Promise<string> ; } export interface UIDevice { id: string, name: string }
DanxiongLei/Vimdroid
lib/util/utils.ts
/** * Created by ldx on 2017/4/9. */
DanxiongLei/Vimdroid
lib/util/logger.ts
<reponame>DanxiongLei/Vimdroid /** * Created by ldx on 2017/4/7. */ import * as path from "path"; import {Config} from "../index"; export default class logger { public static log(...args) { if (!Config.DEBUG) { return; } args.forEach((item, index, array) => { if...
DanxiongLei/Vimdroid
lib/constants.ts
/** * Created by ldx on 2017/4/7. */ const ANDROID_PACKAGE_NAME = "com.damonlei.vimdroid"; const constants = { CMD_ID: { ping: 236, keyboard: 237, ensurePrepared: 238, shutdown: 239 }, RESP_STATUS: { OK: 0, FAILURE: -1, FAILURE_NOT_FATAL: -2 }, ...
DanxiongLei/Vimdroid
lib/device/base.ts
/** * Created by ldx on 2017/4/7. */ import constants from "../constants"; import {Socket} from "net"; import logger from "../util/logger"; /** * UIDevice * - onCreate 初始化 * - isInitialized 判断是否初始化 * - communicate(id, string) : string * - isConnected 判断是否仍在连接状态 * * 无连接状态 --> 无准备状态 --> 准备完成状态 */ export ...
hieutran3010/EnglishOnline
src/app/components/collection/List/DatasourceInfiniteLoadingList.tsx
import React, { memo, useCallback, useEffect, useMemo, useState } from 'react'; import * as Sentry from '@sentry/react'; import InfiniteLoadingList, { IInfiniteLoadingListProps, } from './InfiniteLoadingList'; import { IDataSource, OrderOption, QueryCriteria, QueryOperator, } from '../types'; import { concat,...
hieutran3010/EnglishOnline
src/app/components/AppNavigation/LeftNavigation.tsx
<gh_stars>0 import React, { memo } from 'react'; import { Layout } from 'antd'; import Menu from './Menu'; import { IMenuItem } from './types'; const { Sider } = Layout; interface LeftNavigation { isCollapsed: boolean; menus: IMenuItem[]; appName?: string; onSelectedMenuChanged?: (key: string) => void; selec...
hieutran3010/EnglishOnline
src/app/containers/Post/types.ts
import Post from 'app/models/post'; /* --- STATE --- */ export interface PostState { isFetchingPosts: boolean; posts: Post[]; } export type ContainerState = PostState;
hieutran3010/EnglishOnline
src/app/components/collection/AutoComplete/AutoComplete.tsx
import React, { useState, useCallback, useMemo } from 'react'; import { AutoComplete } from 'antd'; import { AutoCompleteProps } from 'antd/lib/auto-complete'; import isEmpty from 'lodash/fp/isEmpty'; import find from 'lodash/fp/find'; import get from 'lodash/fp/get'; import set from 'lodash/fp/set'; import map from 'l...
hieutran3010/EnglishOnline
src/app/fetchers/base/GraphQLFetcherBase.ts
<filename>src/app/fetchers/base/GraphQLFetcherBase.ts import { GraphQLDoorClient, GraphQLEntityFetcher } from 'graphql-door-client'; import { authService } from 'app/services/auth'; export default class GraphQLFetcherBase<TModel> extends GraphQLEntityFetcher< TModel > { graphqlDoorClient: GraphQLDoorClient; con...
hieutran3010/EnglishOnline
src/app/containers/Post/selectors.ts
import { createSelector } from '@reduxjs/toolkit'; import { RootState } from 'types'; import { initialState } from './slice'; const selectDomain = (state: RootState) => state.post || initialState; export const selectPosts = createSelector( [selectDomain], postState => postState.posts, ); export const selectIsFe...
hieutran3010/EnglishOnline
src/app/containers/Courses/index.tsx
/** * * Courses * */ import React, { memo } from 'react'; import { useSelector, useDispatch } from 'react-redux'; import { useInjectReducer, useInjectSaga } from 'utils/redux-injectors'; import { reducer, sliceKey } from './slice'; import { selectCourses } from './selectors'; import { coursesSaga } from './saga'; in...
hieutran3010/EnglishOnline
src/app/containers/Auth/EmailVerification/index.tsx
/** * * EmailVerification * */ import React, { memo, useCallback, useState } from 'react'; import { toast } from 'react-toastify'; import { Result, Button, Space } from 'antd'; import { useHistory } from 'react-router-dom'; import { authService, authStorage } from 'app/services/auth'; export const EmailVerificat...
hieutran3010/EnglishOnline
src/app/components/Layout/RootContainer.tsx
<gh_stars>0 import React, { ReactElement, useCallback, useMemo } from 'react'; import { PageHeader } from 'antd'; import { StyledContainer } from './styles/StyledRootContainer'; import { PageHeaderProps } from 'antd/lib/page-header'; interface Props { title: string | ReactElement; subTitle?: string; children: an...
hieutran3010/EnglishOnline
src/app/fetchers/base/RestfulFetcherBase.ts
<reponame>hieutran3010/EnglishOnline import WrappedAxiosFetcher from './WrappedAxiosFetcher'; import { authService } from 'app/services/auth'; export default class RestfulFetcherBase<TModel> extends WrappedAxiosFetcher< TModel > { constructor(controller: string) { const endpoint = `${process.env.REACT_APP_API_...
hieutran3010/EnglishOnline
src/app/fetchers/postCommentFetcher.ts
import PostComment from 'app/models/postComment'; import { GraphQLFetcherBase } from './base'; export default class PostCommentFetcher extends GraphQLFetcherBase< PostComment > { selectFields: string[] = ['id', 'owner', 'content', 'postId']; constructor() { super('PostComment', () => this.selectFields); }...
hieutran3010/EnglishOnline
src/app/models/user.ts
<reponame>hieutran3010/EnglishOnline<filename>src/app/models/user.ts import ModelBase from './modelBase'; export default class User extends ModelBase { email!: string; emailVerified!: boolean; phoneNumber?: string; password?: string; displayName!: string; avatarUrl?: string; role?: string; disabled?: b...
hieutran3010/EnglishOnline
src/app/components/Layout/styles/StyledRootContainer.ts
<reponame>hieutran3010/EnglishOnline<filename>src/app/components/Layout/styles/StyledRootContainer.ts<gh_stars>0 import styled from 'styled-components/macro'; export const StyledContainer = styled.div` background-color: white; border-radius: 10px; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px...
hieutran3010/EnglishOnline
src/app/containers/HomePage/index.tsx
/* * HomePage * * This is the first thing users see of our App, at the '/' route * */ import React, { useEffect, useCallback, useState } from 'react'; import { Route, Switch, useHistory, Redirect } from 'react-router-dom'; import { Spin, Menu, Layout, Tooltip } from 'antd'; import { HomeOutlined, FileProtectO...
hieutran3010/EnglishOnline
src/app/models/post.ts
import ModelBase from './modelBase'; import PostComment from './postComment'; export default class Post extends ModelBase { owner!: string; content!: string; ownerAvatar!: string; postComments?: PostComment[]; }
hieutran3010/EnglishOnline
src/app/containers/HomePage/Loadable.tsx
<filename>src/app/containers/HomePage/Loadable.tsx<gh_stars>0 /** * Asynchronously loads the component for HomePage */ import React from 'react'; import { lazyLoad } from 'utils/loadable'; import { LazyLoadingSkeleton } from 'app/components/Skeleton'; export const HomePage = lazyLoad( () => import('./index'), mo...
hieutran3010/EnglishOnline
src/app/fetchers/base/WrappedAxiosFetcher.ts
import axios, { AxiosResponse, AxiosRequestConfig } from 'axios'; import qs from 'qs'; export default class WrappedAxiosFetcher<T> { baseUrl: string; onGetIdTokenAsync?: () => Promise<string>; constructor(endpoint: string, onGetIdTokenAsync?: () => Promise<string>) { this.baseUrl = endpoint; this.onGetI...
hieutran3010/EnglishOnline
src/app/containers/Courses/types.ts
<reponame>hieutran3010/EnglishOnline /* --- STATE --- */ export interface CoursesState {} export type ContainerState = CoursesState;
hieutran3010/EnglishOnline
src/app/collection-datasource/graphql/constants.ts
<reponame>hieutran3010/EnglishOnline<gh_stars>0 export const GRAPHQL_QUERY_OPERATOR = { CONTAINS: 'Contains', EQUALS: '==', NOT_EQUAL: '!=', GT: '>', GTE: '>=', LT: '<', LTE: '<=', ANY_FALSE: 'Any', ANY_TRUE: 'Any', };
hieutran3010/EnglishOnline
src/app/index.tsx
/** * * App * * This component is the skeleton around the actual pages, and should only * contain code that should be seen on all pages. (e.g. navigation bar) */ import * as React from 'react'; import { Helmet } from 'react-helmet-async'; import { Switch, Route, BrowserRouter } from 'react-router-dom'; import {...
hieutran3010/EnglishOnline
src/app/components/Layout/ContentContainer.tsx
import React from 'react'; import { Card } from 'antd'; import { CardProps } from 'antd/lib/card'; import omit from 'lodash/fp/omit'; const ContentContainer = (props: CardProps) => { const { children, style } = props; return ( <Card className="content-container" size="small" style={{ ...
hieutran3010/EnglishOnline
src/app/fetchers/postFetcher.ts
import Post from 'app/models/post'; import { GraphQLFetcherBase } from './base'; export default class PostFetcher extends GraphQLFetcherBase<Post> { selectFields: string[] = ['id', 'owner', 'content']; constructor() { super('Post', () => this.selectFields); } }
hieutran3010/EnglishOnline
src/app/containers/Auth/Login/index.tsx
<reponame>hieutran3010/EnglishOnline /** * * Login * */ import React, { memo, useCallback, useMemo, useState } from 'react'; import { useSelector, useDispatch } from 'react-redux'; import { Form, Input, Button, Alert, Space } from 'antd'; import { UserOutlined, LockOutlined } from '@ant-design/icons'; import isEmp...
hieutran3010/EnglishOnline
src/app/components/Select/index.ts
<filename>src/app/components/Select/index.ts import CountrySelect from './CountrySelect'; export { CountrySelect };