npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

location-sender

v1.0.2

Published

Send users curreunt location on the specific endpoint for spection interval

Downloads

4

Readme

Location Sender Location Sender is a simple and lightweight JavaScript package that periodically sends the user's current geographic location to a specified API endpoint at configurable time intervals. This package leverages the browser's Geolocation API to obtain accurate latitude and longitude data and provides methods to start and stop location tracking based on user preference.

Features: Easy Integration: Quickly integrate location tracking functionality into any web or Node.js application. Customizable Interval: Set a custom time interval for how often to send the location data to the server. Start/Stop Control: Provides simple methods to start and stop sending location data at any time. Error Handling: Gracefully handles errors from the Geolocation API. Lightweight: Minimal dependencies, using only axios for HTTP requests. Installation: To install the package, run:

bash Copy code npm install location-sender Usage: Here's an example of how to use the Location Sender package:

javascript Copy code const LocationSender = require('location-sender');

// Replace with your API endpoint and interval time in milliseconds const apiUrl = 'https://your-api-endpoint.com/location'; const interval = 5000; // Send every 5 seconds

const sender = new LocationSender(apiUrl, interval);

// Start sending location sender.start();

// Stop after 30 seconds (for demonstration purposes) setTimeout(() => { sender.stop(); }, 30000); Parameters: apiUrl: (String) The endpoint URL where the location data will be sent via a POST request. interval: (Number) The interval time in milliseconds for sending location updates (default: 60,000 milliseconds or 1 minute). Methods: start(): Starts tracking and sending the location to the specified API endpoint at the configured interval. stop(): Stops the location tracking and sending process. Examples: To create a location sender that sends data every 10 seconds:

javascript Copy code const sender = new LocationSender('https://your-api.com/location', 10000); sender.start(); To stop the sender after 1 minute:

javascript Copy code setTimeout(() => { sender.stop(); }, 60000); Browser Compatibility: This package relies on the browser's Geolocation API, which is supported in most modern web browsers. Make sure to handle cases where geolocation is not available or the user denies location access.

Security and Privacy: Always ask for user consent before accessing and transmitting location data. Ensure that the API endpoint uses HTTPS to protect user privacy and data integrity. Handle location data responsibly and in accordance with local regulations and best practices for user privacy. License: This package is licensed under the MIT License. See the LICENSE file for more details.

End of Description Feel free to customize this description to match the tone and branding of your package or project!