ng-web-apis
ng-web-apis copied to clipboard
A set of common utils for consuming Web APIs with Angular
Common utils for Web APIs
Part of
Web APIs for Angular
A set of common utils for consuming Web APIs with Angular
Tokens
WINDOW— provides access to globalwindowobjectNAVIGATOR— provides access towindow.navigatorobjectNETWORK_INFORMATION— provides access towindow.navigator.connectionobjectUSER_AGENT— provides access towindow.navigator.userAgentstringMEDIA_DEVICES— provides access towindow.navigator.mediaDevicesobjectPERFORMANCE— provides access towindow.performanceobjectANIMATION_FRAME— sharedObservablebased onwindow.requestAnimationFrameCACHES— provides access towindow.cachesobjectCSS— provides access towindow.CSSobject or mock object if it's not available (i.e. in IE)CRYPTO— provides access towindow.cryptoobjectLOCATION— provides access towindow.locationobjectLOCAL_STORAGE— provides access towindow.localStorageobjectSESSION_STORAGE— provides access towindow.sessionStorageobjectSPEECH_RECOGNITION— provides access toSpeechRecognitionclass or returnsnullif browser does not support itSPEECH_SYNTHESIS— provides access towindow.speechSynthesisobjectPAGE_VISIBILITY— wrapper fordocument.addEventListener('visibilityChange')apiHISTORY— provides access towindow.historyobject
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 |
![]() Roman Sedov |

