Socket
Book a DemoInstallSign in
Socket

@gennadysx/react-native-background-thread

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gennadysx/react-native-background-thread

Run your code in background thread

1.2.2
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

@gennadysx/react-native-background-thread

This package helps in executing the javascript in a background thread. Time-consuming javascript code is shifted to a native background thread by freeing the main-UI thread, which helps in increasing the efficiency of the application. Thread priority can be handled by passing in the appropriate flags. Currently we support three types of flag as under:

Priority FlagsDescriptionAndroid thread valueIOS thread value
MAXThis sets the thread priority to the maximum available on the corresponding native platform.101.0
MINThis sets the thread priority to the minmimum available on the corresponding native platform.10.1
NORMALThis sets the thread priority to the default or normal on the corresponding native platform.50.5

Getting started

$ yarn add @gennadysx/react-native-background-thread

Linking

iOS

1. 	Add pod 'react-native-bg-thread', :path => '../node_modules/@gennadysx/react-native-background-thread/react-native-background-thread.podspec' to your pod file under targets
	Run following commands
2. 	cd ios
3. 	pod install

Android

No further action needed

Usage

Example 1

with Priority flag

import {run, BackgroundThreadPriority} from '@gennadysx/react-native-background-thread';

      run(() => {
        // Your Javascript code here
      }, BackgroundThreadPriority.MIN); // Also you can set your priority here BackgroundThreadPriority.MAX or BackgroundThreadPriority.NORMAL

Example 2

import BackgroundThread from '@gennadysx/react-native-background-thread';

        BackgroundThread.run(()=>{
            // Your Javascript code here
        })

Keywords

GennadySX

FAQs

Package last updated on 23 Sep 2022

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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.