update tsconfig

This commit is contained in:
Philipp Kunz 2024-04-14 18:39:02 +02:00
parent 45b0b5d011
commit d3e854ccc7
4 changed files with 114 additions and 30 deletions

View File

@ -5,16 +5,24 @@
"githost": "code.foss.global",
"gitscope": "push.rocks",
"gitrepo": "webdetector",
"description": "detect things about from within a webapp",
"description": "A library to detect web environments and PWA installation status within a browser.",
"npmPackagename": "@push.rocks/webdetector",
"license": "MIT"
"license": "MIT",
"keywords": [
"web environment detection",
"PWA status",
"online status check",
"platform detection",
"network status",
"browser detection"
]
}
},
"npmci": {
"npmGlobalTools": [],
"npmAccessLevel": "public"
},
"tsdocs": {
"tsdoc": {
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
}
}

View File

@ -2,7 +2,7 @@
"name": "@push.rocks/webdetector",
"version": "2.0.3",
"private": false,
"description": "detect different environments within the browser",
"description": "A library to detect web environments and PWA installation status within a browser.",
"main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts",
"author": "Lossless GmbH",
@ -39,5 +39,13 @@
"cli.js",
"npmextra.json",
"readme.md"
],
"keywords": [
"web environment detection",
"PWA status",
"online status check",
"platform detection",
"network status",
"browser detection"
]
}

1
readme.hints.md Normal file
View File

@ -0,0 +1 @@

119
readme.md
View File

@ -1,36 +1,103 @@
# @pushrocks/webdetector
detect things about from within a webapp
# @push.rocks/webdetector
detect different environments within the browser
## Availabililty and Links
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/webdetector)
* [gitlab.com (source)](https://gitlab.com/pushrocks/webdetector)
* [github.com (source mirror)](https://github.com/pushrocks/webdetector)
* [docs (typedoc)](https://pushrocks.gitlab.io/webdetector/)
## Install
To install `@push.rocks/webdetector`, you can use npm or yarn. Run the following command in your terminal:
## Status for master
```bash
npm install @push.rocks/webdetector --save
```
or if you prefer using yarn:
```bash
yarn add @push.rocks/webdetector
```
Status Category | Status Badge
-- | --
GitLab Pipelines | [![pipeline status](https://gitlab.com/pushrocks/webdetector/badges/master/pipeline.svg)](https://lossless.cloud)
GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/pushrocks/webdetector/badges/master/coverage.svg)](https://lossless.cloud)
npm | [![npm downloads per month](https://badgen.net/npm/dy/@pushrocks/webdetector)](https://lossless.cloud)
Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/pushrocks/webdetector)](https://lossless.cloud)
TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud)
node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud)
PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@pushrocks/webdetector)](https://lossless.cloud)
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@pushrocks/webdetector)](https://lossless.cloud)
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@pushrocks/webdetector)](https://lossless.cloud)
This package is designed to work in a browser environment.
## Usage
The `@push.rocks/webdetector` module provides a powerful toolset to detect various aspects of the user's browser environment, such as online status, platform type, and PWA (Progressive Web App) installation status. It leverages modern web technologies and observables for real-time detection and updates.
### Importing the Module
First, you need to import the module in your project using ESM syntax:
## Contribution
```typescript
import { WebDetector } from '@push.rocks/webdetector';
```
We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :)
### Initializing WebDetector
To start utilizing WebDetector, you need to create an instance of it by passing configuration options. The most crucial option is the `checkOnlineUrl`, which is used to verify internet connectivity.
For further information read the linked docs at the top of this readme.
```typescript
const webDetector = new WebDetector({
checkOnlineUrl: 'https://example.com', // URL to check online status
});
```
## Legal
> MIT licensed | **©** [Task Venture Capital GmbH](https://task.vc)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
### Checking Online Status
WebDetector can check if the browser can reach the internet. This is not a mere online/offline status provided by the browser but a more reliable check that attempts to fetch a predetermined URL.
```typescript
async function checkOnlineStatus() {
const isOnline = await webDetector.isOnline();
console.log(`Online status: ${isOnline}`);
}
checkOnlineStatus();
```
### Observing Real-Time Online Status
WebDetector allows you to observe changes in online status in real-time, which is useful for applications that need to react to connectivity changes promptly.
```typescript
webDetector.startPeriodicChecks();
webDetector.onlineObservable.subscribe((state) => {
console.log(`Current state: ${state}`);
});
// Remember to stop the periodic checks when they are no longer needed
webDetector.stopPeriodicChecks();
```
### Detecting the Platform
You can easily detect the user's platform (e.g., iOS, Android, Windows, etc.) using WebDetector.
```typescript
const platform = webDetector.platform.detectPlatform();
console.log(`Platform detected: ${platform}`);
```
### Checking PWA Installation Status
For Progressive Web Apps, it's vital to know if the user has installed the app. WebDetector provides a straightforward way to check this.
```typescript
const isPwaInstalled = webDetector.pwa.isInstalled();
console.log(`Is PWA Installed: ${isPwaInstalled}`);
```
### Comprehensive Observables Integration
`@push.rocks/webdetector` integrates seamlessly with observables provided by RxJS through `@pushrocks/smartrx`, making it easy to integrate with frameworks that use observables for state management.
### Conclusion
`@push.rocks/webdetector` is a versatile module that helps detect various aspects of the browser environment, offering tools for checking connectivity, platform type, and PWA installation status. By utilizing observables for real-time updates, it fits well into modern web application architectures.
Remember, the accurate detection and reaction to the user's environment enhance the user experience significantly, making `@push.rocks/webdetector` a valuable addition to your web development toolkit.
For more advanced use cases, refer to the official documentation and source code available on GitHub and GitLab. Your contributions and feedback are welcome to help improve this project further.
## License and Legal Information
This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository.
**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
### Trademarks
This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.
### Company Information
Task Venture Capital GmbH
Registered at District court Bremen HRB 35230 HB, Germany
For any legal inquiries or if you require further information, please contact us via email at hello@task.vc.
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.