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 🙏

© 2026 – Pkg Stats / Ryan Hefner

kirgawa-react-sdk

v0.0.3

Published

Official SDK for the Kirgawa AP

Readme

kirgawa-react-sdk

Official SDK for the Kirgawa APP

A simple JavaScript SDK for interacting with the Kirgawa API. The kirgawa-react-sdk package provides a hook useStageTimer that allows you to track the duration of a stage event in a React application.

Installation

To install the package, you can use npm or yarn:

npm install kirgawa-react-sdk
yarn add kirgawa-react-sdk

Usage

First, import the SDK and initialize it with your API key and context. The init function must be called with an API key and a context before using the hook. The apiKey parameter is a string representing the API key for the Kirgawa SDK, and the context parameter can be set to either "prod" or "local" depending on the environment.

import kirgawa from 'kirgawa-sdk'

kirgawa.init({
  apiKey: 'YOUR_API_KEY',
  context: 'prod' // 'local', or 'prod'
})

You can generate an API key in the Kirgawa dashboard.

Then, import the hook and use it in your component:

getStageTimers()

This method gets a list of all the stage timers available.

kirgawa.getStageTimers().then(response => {
  console.log(response.data)
}).catch(error => {
  console.log(error)
})

getStageTime(id: string)

This method gets a single stage timer by its id.

kirgawa.getStageTime('STAGE_TIMER_ID').then(response => {
  console.log(response.data)
}).catch(error => {
  console.log(error)
})

createStageTimer(data: CreateStageTimer)

This method creates a new stage timer with the provided data.

const data = {
  title: 'Event Title',
  startAt: '2022-01-01T00:00:00.000Z',
  endAt: '2022-01-01T01:00:00.000Z', // pass any date value if you don't want to set an end date
  meta: '{"description": "Event Description"}' // optional
}

kirgawa.createStageTimer(data).then(response => {
  console.log(response.data)
}).catch(error => {
  console.log(error)
})

useStageTimer(options: StageTimerOptions)

Then, you can use the useStageTimer hook in your component:

import { useStageTimer } from 'kirgawa-react-sdk';
const data = useStageTimer({  continuous: true, eventId: '7dfbeeec-ce2e-47ef-adca-e3dc758a4a07' }) as any;

The useStageTimer hook takes an options object with the properties continuous and eventId. The continuous property is a boolean that indicates if the timer should continue counting even when the end event has been triggered (defaults to false). The eventId property is a string that represents the event id. The hook returns an object with the following properties:

  • hour: the number of hours that have passed since the start event
  • minute: the number of minutes that have passed since the start event
  • second: the number of seconds that have passed since the start event
  • timestamp: the timestamp of the start event
  • timeSpent: the number of seconds that have passed since the start event
  • error: an error object if there was an error during the start or end events
  • onEnd(): a function that can be called to trigger the end event
  • onStart(): a function that can be called to trigger the start event

It's important to note that the eventId property is required for the hook to work. If the eventId is not provided, the hook will return an object with the error property set to an error object.

Example

Sure, here's an example of how you can destructure the data object to access the properties directly:

import { init, useStageTimer } from 'kirgawa-react-sdk';

init({
  apiKey: "Y2xjeHlzZWx3MDAwNDFqMXI2cHB3YzdqYw.xzHc7_K3OkzZkIkJdPdLX7ufFYnAHncsIcFa1VQqbi5A_KmGSgmBy_Unw_mZ",
  context: 'local'
})

const ExampleApp = () => {
  const { hour, minute, second, timestamp, onEnd, onStart, timeSpent, error } = useStageTimer({  continuous: true, eventId: '7dfbeeec-ce2e-47ef-adca-e3dc758a4a07' });

  return <div>
    <button onClick={onEnd}>End</button>
    <button onClick={onStart}>Start</button>

    <div>Hour: {hour}</div>
    <div>Minute: {minute}</div>
    <div>Second: {second}</div>
    <div>Time spent: {timeSpent}</div>

  </div>;
};

Types

CreateStageTimer

    export type CreateStageTimer = {
      title: string
      startAt: string
      endAt?: string
      meta?: string
    }

StageTimerOptions

    
    export type StageTimerOptions = {
      continuous?: boolean
      eventId: string
    }

KirgawaSDKInit

    export type KirgawaSDKInit = {
      apiKey: string
      context: 'local' | 'prod'
    }