🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@krai-tech/web-api

A set of common tokens for consuming Web API with Angular.

1.0.0
latest
Version published
Weekly downloads
0
-100%
Maintainers
0
Weekly downloads
 
Created

KRAI WEB API Logo

KRAI Web API

Website

Web API for Angular creates injection tokens for working with native web APIs, simplifying their implementation, testing, and maintenance in Angular applications.

Purpose

  • Testability: Injection tokens allow replacing real web APIs with mocks during testing.
  • SSR: During server-side rendering (SSR), some web APIs are unavailable. Injection tokens help adapt the code to work on both client and server.

Installation

npm i @krai-tech/web-api
# or
yarn i @krai-tech/web-api

Import

import { Token_Name } from '@krai-tech/web-api/tokens';

Tokens

  • WINDOW — provides access to the global window object
  • NAVIGATOR — provides access to the window.navigator object
  • USER_AGENT — provides access to the window.navigator.userAgent string
  • ANIMATION_FRAME — shared Observable based on window.requestAnimationFrame
  • CRYPTO — provides access to the window.crypto object
  • LOCATION — provides access to the window.location object
  • LOCAL_STORAGE — provides access to the window.localStorage object
  • SCREEN — provides access to the window.screen object
  • SESSION_STORAGE — provides access to the window.sessionStorage object
  • PAGE_VISIBILITY — wrapper for the API document.addEventListener('visibilityChange')
  • HISTORY — provides access to the window.history object

Contribution

Yes please! See the contributing guidelines for details.

Documentation

Getting Started

License

This project is licensed under the terms of the MIT license.

FAQs

Package last updated on 05 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts