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

@letseedev/geofencing

v0.0.4

Published

letsee geofencing npm package

Downloads

15

Readme

@letseedev/geofencing


사용법

1. 패키지 설치

npm i @letseedev/geofencing@latest

    

2. GeofencingMap : Admin의 Geofence Map Tool 컴포넌트

import { GeofencingWorker, GeofencingMap, Client } from '@letseedev/geofencing'

const App = () => {
    // new GeofencingWorker(GateHostURL[String], MasterId[String], ProjectId[String])
    const gw = new GeofencingWorker('https://192.168.1.6:8000', 'test', '1');

    return(
        <>
            // <GeofencingMap>의 파라메터 
            // geofencingWorker : GeofencingWorker class (필수)
            // initCenter : 처음 지도 오픈 시 지도의 중심 위/경도 좌표. (default: [lat, lng])   
            // initZoom : 처음 지도 오픈 시 Zoom 정도. 숫자가 클수록 좁은 범위를 넓게 볼 수 있음. 1~19 (default: 13)
            <GeofencingMap geofencingWorker={gw} initCenter={[37.506012, 127.058175]} initZoom={13} />
        </>
    )
}
export default App

    

3. Client : Client의 Tracker 클래스

import { GeofencingWorker, GeofencingMap, Client } from 'letsee-geofencing'

const App = () => {
    // new GeofencingWorker(GateHostURL[String], MasterId[String], ProjectId[String])
    const gw = new GeofencingWorker('https://192.168.1.6:8000', 'test', '1');

    // new Client(geofencingWorker[GeofencingWorker], Client_id[String])
    let client = new Client(gw, 'test_id');

    // 사용자의 위치(GPS)가 Fence 내부에 있을때 실행되는 함수
    const userInside = (fenceData) => {
        console.log("inside!!", fenceData)
    }

    // 사용자의 위치(GPS)가 Fence 외부에 있을때 실행되는 함수
        const userOutside = () => {
        console.log("outside!!")
    }
    // client.startGPS(insideCB, outsideCB, _options);
    client.startGPS( userInside, userOutside );

    return(
        <>
        </>
    )
}
export default App

    

4. 설명

GeofencingWorker Class는 Backend의 Gate와 통신하는 주체로,

  1. Gate의 URL

  2. MasterId

  3. ProjectId

    세 파라메터를 가지고 생성되며, GeofencingMap과 Client 모두에 사용된다.

Client Class의 startGPS() 함수 내부에서는 navigator.geolocation.watchPosition()이 생성된다.

startGPS([팬스 내부일때 실행할 콜백함수], [팬스 외부일때 실행할 콜백함수], [watchPosition의 옵션])

watchPosition의 옵션: maximumAge, timeout, enableHighAccuracy


수정 및 NPM 배포

git clone https://github.com/letsee/letsee-geofencing-npm.git
git checkout develop
npm i
# 코드 수정
npm version patch -f  ## 혹은 npm version 0.4.0 -f
npm publish