Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

sdk

Recommended

A collection of existing widely adopted tools that every project should include by default that doesn't inflate bundle size.

Libraries

Polyfills

Even though these may result in bundle size increase up to 100kb gzip, there are assumed to be already shipped. You can conditionally import polyfills that they are excluded from bundle and downloaded only if user's browser misses needed support.

Example

polyfills.ts

/* requestIdleCallback */

window.requestIdleCallback ??= callback => {
  const start = Date.now()
  return setTimeout(() => callback({
    didTimeout: false,
    timeRemaining: () => Math.max(0, 50 - (Date.now() - start))
  }), 1) as unknown as number
}
window.cancelIdleCallback ??= clearTimeout


/* `Array.prototype.at` */

Array.prototype.at ??= function (index) {
  if (index < 0) return this[this.length - 1 + index]
  return this[index]
}

/* iterator-helpers-polyfill */

if (window.Iterator?.prototype.filter == null) {
  const { installIntoGlobal } = await import("iterator-helpers-polyfill")
  installIntoGlobal()
}

/* URLPattern */

// @ts-expect-error `URLPattern` exists in `Global`.
if (window.URLPattern == null) {
  await import("urlpattern-polyfill")
}

index.ts

import "./polyfills.ts"

Specific Libraries

There are more specific libraries that solve one specific problem, here's a list.

SDK

Install

bun i @denshya/sdk

Tools

Name
bem
isRecord
interpolate
stopPropagation
inputValue
BiMap
Enum
FileTranform (fetch/url)
percentage
phonenumber
price
progress
Time
TimeSpan
Units
predicates
getCircularReplacer
KeyChain
measurePerformance
TextNodeUtils
AudioTools
Viewport
ClientSocket
FilePreview
FormRecord
FormIssues
FormDataEnhanced
WindowTab

Types

  • URL*
  • FormElements
  • ExtractInterpolations

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors