Git Product home page Git Product logo

common's Introduction

logo Common utils for Web APIs

Part of Web APIs for Angular

npm version npm bundle size Travis (.org) Coveralls github

A set of common utils for consuming Web APIs with Angular

Tokens

  • WINDOW — provides access to global window object
  • NAVIGATOR — provides access to window.navigator object
  • NETWORK_INFORMATION — provides access to window.navigator.connection object
  • USER_AGENT — provides access to window.navigator.userAgent string
  • PERFORMANCE — provides access to window.performance object
  • ANIMATION_FRAME — shared Observable based on window.requestAnimationFrame
  • CACHES — provides access to window.caches object
  • CSS — provides access to window.CSS object or mock object if it's not available (i.e. in IE)
  • LOCATION — provides access to window.location object
  • LOCAL_STORAGE — provides access to window.localStorage object
  • SESSION_STORAGE — provides access to window.sessionStorage object
  • SPEECH_RECOGNITION — provides access to SpeechRecognition class or returns null if browser does not support it
  • SPEECH_SYNTHESIS — provides access to window.speechSynthesis object
  • PAGE_VISIBILITY — wrapper for document.addEventListener('visibilityChange') api

How to use

Just inject a token you need. You can also take a look at Stackblitz sample

What advantages do we get from abstract entities in our app?

👨‍🎓 It is easy to understand: you see all dependencies of your entity in its constructor

🧞 It is easy to test: you can just mock any of your dependencies to test

🧩 It is easy to reuse: your components and directives can be used in any context if it has dependencies that they need to be created

♻️ It is environment agnostic: you can start your app in SSR or other environments (see also @ng-web-apis/universal)

See also

Other Web APIs for Angular by @ng-web-apis

Core team

Alex Inkin
Alex Inkin
Roman Sedov
Roman Sedov

common's People

Contributors

dependabot[bot] avatar dmitriykhirniy avatar marsibarsi avatar thekiba avatar waterplea avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.