Latest Threat ResearchGlassWorm Loader Hits Open VSX via Developer Account Compromise.Details
Socket
Book a DemoInstallSign in
Socket

@takala/client

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@takala/client

@takala/frontend is lightweight, generic solution to all your error handling.

npmnpm
Version
0.0.11
Version published
Weekly downloads
22
Maintainers
1
Weekly downloads
 
Created
Source

Takala - frontend package

@takala/frontend is lightweight, generic solution to all your error handling.

Installation

Use npm to install @takala/frontend.

npm install @takala/frontend

Usage

ReactJS

Simple usage

in your root file

import Tk from "@takala/frontend";

Tk.initialize("--your takala token--");

in any place you want to trigger error handler

import React from 'react'
import axios from 'axios'
import Tk from '@takala/frontend'

const App = () => {
   useEffect(()=>{
      axios.get('some api ur',(response)=>{
         if(response.status == 200){
             //handle your happy flow
         }else{
            Tk.set(response) // we will do the rest
         }
      }).catch(err=>{
         Tk.set(err)
      })
   },[])

  return (
      <div>
        {* your jsx *}
      </div>
  )
}

With callback

import React from 'react'
import axios from 'axios'
import Tk from '@takala/frontend'

const App = () => {
   const handleFallback = (data) => {
      //send the data you collect using takala to your api
   }

   // just pass the callback to Tk.set() function as second parameter
   useEffect(()=>{
      axios.get('some api ur',(response)=>{
         if(response.status == 200){
             //handle your happy flow
         }else{
            Tk.set(response,handleFallback) // we will do the rest
         }
      }).catch(err=>{
         Tk.set(err,handleFallback)
      })
   },[])

  return (
      <div>
        {* your jsx *}
      </div>
  )
}

Angular

import Tk from "@takala/frontend";

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

FAQs

Package last updated on 03 Aug 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts