Options
All
  • Public
  • Public/Protected
  • All
Menu

@fujia/hammer

Index

Variables

emptyObject

emptyObject: Readonly<{}> = ...

isBrowser

isBrowser: boolean = ...

isDev

isDev: boolean = ...

isNavigator

isNavigator: boolean = ...

isProd

isProd: boolean = ...

scrollbarWidth

scrollbarWidth: ScrollbarWidth = ...

Functions

Const addListener

  • addListener<T>(obj: null | T, ...args: Parameters<T["addEventListener"]> | [string, null | VoidFunction, ...any[]]): void
  • Type parameters

    • T: Window | EventTarget | Document | HTMLElement

    Parameters

    • obj: null | T
    • Rest ...args: Parameters<T["addEventListener"]> | [string, null | VoidFunction, ...any[]]

    Returns void

batch

  • batch(fn: any): (target: unknown, ...rest: any[]) => any
  • Parameters

    • fn: any

    Returns (target: unknown, ...rest: any[]) => any

      • (target: unknown, ...rest: any[]): any
      • Parameters

        • target: unknown
        • Rest ...rest: any[]

        Returns any

Const cacheStringFunction

  • cacheStringFunction<T>(fn: T): T

Const capitalizeFirstLetter

  • capitalizeFirstLetter(str: string): string
  • Parameters

    • str: string

    Returns string

Const chain

  • chain(fns: VoidFunction[], errCallback: VoidFunction): undefined | Promise<unknown>
  • Parameters

    • fns: VoidFunction[]
    • errCallback: VoidFunction

    Returns undefined | Promise<unknown>

Const chunk

  • chunk<T>(arr: T[], size?: number): T[][]
  • Type parameters

    • T

    Parameters

    • arr: T[]
    • size: number = 1

    Returns T[][]

Const clone

  • clone(val: Record<any, any>): Record<any, any>

continuous

  • continuous<T>(fn: CallableFunction): (...args: T[]) => T
  • Type parameters

    • T

    Parameters

    • fn: CallableFunction

    Returns (...args: T[]) => T

      • (...args: T[]): T
      • Parameters

        • Rest ...args: T[]

        Returns T

debounce

  • debounce(fn: any, ms?: number): (...args: any[]) => void
  • Parameters

    • fn: any
    • ms: number = 100

    Returns (...args: any[]) => void

      • (...args: any[]): void
      • Parameters

        • Rest ...args: any[]

        Returns void

Const deepClone

  • deepClone(val: Record<any, any>): Record<any, any>

Const deepCloneByJson

  • deepCloneByJson(val: Record<any, any>): any

Const def

  • def(obj: object, key: string | symbol, value: any): void
  • Parameters

    • obj: object
    • key: string | symbol
    • value: any

    Returns void

Const diff

  • diff<T>(arr: T[], compareArr: T[]): T[]
  • Type parameters

    • T

    Parameters

    • arr: T[]
    • compareArr: T[]

    Returns T[]

Const drop

  • drop<T>(arr: T[], size: number): T[]
  • Type parameters

    • T = any

    Parameters

    • arr: T[]
    • size: number

    Returns T[]

Const dropRight

  • dropRight<T>(arr: T[], size: number): T[]
  • Type parameters

    • T = any

    Parameters

    • arr: T[]
    • size: number

    Returns T[]

Const errorLog

  • errorLog(msg: string): void
  • Parameters

    • msg: string

    Returns void

Const flatten

  • flatten<T>(arr: T[]): T[]

Const forEach

  • forEach(val: any, fn: (...arg: any[]) => void): void
  • SYNOPSIS:

    Iterate over an Array or an Object invoking a function for each item.

    If obj is an Array callback will be called passing the value, index, and complete array for each item.

    If 'obj' is an Object callback will be called passing the value, key, and complete object for each property.

    Parameters

    • val: any
    • fn: (...arg: any[]) => void
        • (...arg: any[]): void
        • Parameters

          • Rest ...arg: any[]

          Returns void

    Returns void

Const infoLog

  • infoLog(msg: string): void
  • Parameters

    • msg: string

    Returns void

intercept

  • intercept(fn: any, {{: { afterCall: any; beforeCall: any }): (...args: any[]) => any
  • description

    A function intercepter

    export

    Parameters

    • fn: any

      the called function

    • {{: { afterCall: any; beforeCall: any }

      beforeCall: Function, afterCall: Function }} { beforeCall, a prepositive intercept(er), if exist and return false, the fn will not be executed. afterCall, if exit, can instead of the fn's return value }

      • afterCall: any
      • beforeCall: any

    Returns (...args: any[]) => any

      • (...args: any[]): any
      • Parameters

        • Rest ...args: any[]

        Returns any

Const invokeArrayFns

  • invokeArrayFns(fns: CallableFunction[], arg?: any): void
  • Parameters

    • fns: CallableFunction[]
    • Optional arg: any

    Returns void

Const isArray

  • isArray(val: unknown): val is any[]
  • Parameters

    • val: unknown

    Returns val is any[]

Const isArrayBuffer

  • isArrayBuffer(val: unknown): val is ArrayBuffer
  • Parameters

    • val: unknown

    Returns val is ArrayBuffer

Const isArrayBufferView

  • isArrayBufferView(val: any): val is ArrayBufferView
  • Parameters

    • val: any

    Returns val is ArrayBufferView

Const isBlob

  • isBlob(val: unknown): val is Blob
  • Parameters

    • val: unknown

    Returns val is Blob

Const isBuffer

  • isBuffer(val: any): val is Buffer
  • Parameters

    • val: any

    Returns val is Buffer

Const isDate

  • isDate(val: unknown): val is Date
  • Parameters

    • val: unknown

    Returns val is Date

Const isDef

  • isDef(val: unknown): boolean
  • Parameters

    • val: unknown

    Returns boolean

Const isFalse

  • isFalse(val: unknown): val is false
  • Parameters

    • val: unknown

    Returns val is false

Const isFile

  • isFile(val: unknown): val is File
  • Parameters

    • val: unknown

    Returns val is File

Const isFileList

  • isFileList(val: unknown): val is FileList
  • Parameters

    • val: unknown

    Returns val is FileList

Const isFormData

  • isFormData(val: any): val is FormData
  • Parameters

    • val: any

    Returns val is FormData

Const isFunction

  • isFunction(val: unknown): val is VoidFunction
  • Parameters

    • val: unknown

    Returns val is VoidFunction

Const isInteger

  • isInteger(val: unknown): val is number
  • Parameters

    • val: unknown

    Returns val is number

Const isIntegerKey

  • isIntegerKey(key: unknown): boolean
  • Parameters

    • key: unknown

    Returns boolean

Const isMap

  • isMap(val: unknown): val is Map<any, any>
  • Parameters

    • val: unknown

    Returns val is Map<any, any>

Const isNumber

  • isNumber(val: unknown): val is number
  • Parameters

    • val: unknown

    Returns val is number

Const isObject

  • isObject(val: unknown): val is Record<any, any>
  • Parameters

    • val: unknown

    Returns val is Record<any, any>

Const isOn

  • isOn(val: string): boolean
  • Parameters

    • val: string

    Returns boolean

Const isPalindrome

  • isPalindrome(val: string): boolean

Const isPlainObject

  • isPlainObject(val: unknown): val is Record<any, any>
  • Parameters

    • val: unknown

    Returns val is Record<any, any>

isPrimitive

  • isPrimitive(val: unknown): boolean
  • Parameters

    • val: unknown

    Returns boolean

Const isPromise

  • isPromise<T>(val: unknown): val is Promise<T>
  • Type parameters

    • T = any

    Parameters

    • val: unknown

    Returns val is Promise<T>

Const isRegExp

  • isRegExp(val: unknown): val is RegExp
  • Parameters

    • val: unknown

    Returns val is RegExp

Const isSet

  • isSet(val: unknown): val is Set<any>
  • Parameters

    • val: unknown

    Returns val is Set<any>

Const isStandardBrowserEn

  • isStandardBrowserEn(): boolean
  • Check the running context is a standard browser environment

    web workers: typeof window -> undefined typeof document -> undefined

    react-native: navigator.product -> 'ReactNative' nativescript: navigator.product -> 'NativeScript' or 'NS'

    Returns boolean

Const isString

  • isString(val: unknown): val is string
  • Parameters

    • val: unknown

    Returns val is string

Const isTrue

  • isTrue(val: unknown): val is true
  • Parameters

    • val: unknown

    Returns val is true

Const isTypedArray

  • isTypedArray(): (val: unknown) => boolean
  • Returns (val: unknown) => boolean

      • (val: unknown): boolean
      • Parameters

        • val: unknown

        Returns boolean

Const isURLSearchParams

  • isURLSearchParams(val: unknown): val is URLSearchParams
  • Parameters

    • val: unknown

    Returns val is URLSearchParams

Const isUndef

  • isUndef(val: unknown): val is UndefType
  • Parameters

    • val: unknown

    Returns val is UndefType

Const isValidArrayIndex

  • isValidArrayIndex(val: unknown): boolean
  • Parameters

    • val: unknown

    Returns boolean

localeCompareSupportsLocales

  • localeCompareSupportsLocales(): boolean
  • desc

    check browser support for extended arguments.

    export

    Returns boolean

Const loggerTiming

  • loggerTiming(str: "", start: true): void
  • Parameters

    • str: ""
    • start: true

    Returns void

Const merge

  • merge(...args: Record<any, any>[]): Record<any, any>
  • Parameters

    • Rest ...args: Record<any, any>[]

    Returns Record<any, any>

Const noop

  • noop(): void

Const objToString

  • objToString(): string

once

  • once(fn: null | VoidFunction, replacer?: VoidFunction): VoidFunction
  • Parameters

    • fn: null | VoidFunction
    • Optional replacer: VoidFunction

    Returns VoidFunction

pipe

  • pipe(...fns: any[]): (value: unknown) => any
  • Parameters

    • Rest ...fns: any[]

    Returns (value: unknown) => any

      • (value: unknown): any
      • Parameters

        • value: unknown

        Returns any

Const removeItemFromArray

  • removeItemFromArray<T>(arr: T[], item: T): void
  • Type parameters

    • T

    Parameters

    • arr: T[]
    • item: T

    Returns void

Const removeListener

  • removeListener<T>(obj: null | T, ...args: [string, null | VoidFunction, ...any[]] | Parameters<T["removeEventListener"]>): void
  • Type parameters

    • T: Window | EventTarget | Document | HTMLElement

    Parameters

    • obj: null | T
    • Rest ...args: [string, null | VoidFunction, ...any[]] | Parameters<T["removeEventListener"]>

    Returns void

Const reverse

  • reverse(val: string): string

reverseFuncArgs

  • reverseFuncArgs(fn: any): (...args: any) => any
  • Parameters

    • fn: any

    Returns (...args: any) => any

      • (...args: any): any
      • Parameters

        • Rest ...args: any

        Returns any

Const shuffle

  • shuffle<T>(items: T[]): T[]
  • Type parameters

    • T

    Parameters

    • items: T[]

    Returns T[]

shuffleWithGenerator

  • shuffleWithGenerator<T>(items: T[]): Generator<T, void, unknown>
  • Type parameters

    • T

    Parameters

    • items: T[]

    Returns Generator<T, void, unknown>

Const spreadObjToString

  • spreadObjToString(val: Record<string, unknown>, prefix?: string): undefined | string
  • Parameters

    • val: Record<string, unknown>
    • Optional prefix: string

    Returns undefined | string

Const successLog

  • successLog(msg: string): void
  • Parameters

    • msg: string

    Returns void

throttle

  • throttle(fn: any, ms?: number): (...args: any) => any
  • Parameters

    • fn: any
    • ms: number = 100

    Returns (...args: any) => any

      • (...args: any): any
      • Parameters

        • Rest ...args: any

        Returns any

Const toNumber

  • toNumber(val: any): any
  • Parameters

    • val: any

    Returns any

Const toRawType

  • toRawType(val: unknown): string
  • Parameters

    • val: unknown

    Returns string

Const toTypeString

  • toTypeString(val: unknown): string
  • Parameters

    • val: unknown

    Returns string

Const trim

  • trim(str: string, greed?: boolean): string
  • Parameters

    • str: string
    • greed: boolean = false

    Returns string

Const truncate

  • truncate(val: string, size: number, tail?: string): string
  • Parameters

    • val: string
    • size: number
    • Optional tail: string

    Returns string

Const unique

  • unique<T>(arr: T[]): T[]

Const uniqueBySet

  • uniqueBySet<T>(arr: T[]): T[]

Const warningLog

  • warningLog(msg: string): void
  • Parameters

    • msg: string

    Returns void

Const wipeEmptyOfObj

  • wipeEmptyOfObj<T>(val: T): void | Pick<T, keyof T>
  • Type parameters

    • T: object

    Parameters

    • val: T

    Returns void | Pick<T, keyof T>

Generated using TypeDoc