All Projects → MaxGraey → react-native-console-time-polyfill

MaxGraey / react-native-console-time-polyfill

Licence: MIT license
console.time and console.timeEnd polyfill for react-native

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to react-native-console-time-polyfill

Python Progressbar
Progressbar 2 - A progress bar for Python 2 and Python 3 - "pip install progressbar2"
Stars: ✭ 682 (+641.3%)
Mutual labels:  console, time
Towel
Throw in the towel.
Stars: ✭ 333 (+261.96%)
Mutual labels:  console, measurements
Tqdm
A Fast, Extensible Progress Bar for Python and CLI
Stars: ✭ 20,632 (+22326.09%)
Mutual labels:  console, time
Criterion
Microbenchmarking for Modern C++
Stars: ✭ 140 (+52.17%)
Mutual labels:  console, measurements
fancyline
Readline-esque library with fancy features
Stars: ✭ 72 (-21.74%)
Mutual labels:  console
tty-editor
Opens a file or text in the user's preferred editor
Stars: ✭ 26 (-71.74%)
Mutual labels:  console
IsExternalInit
A source code only package which allows you to use C# 9's init and record features in older target frameworks like .NET Standard 2.0 or the "old" .NET Framework by providing a polyfill for the IsExternalInit class.
Stars: ✭ 75 (-18.48%)
Mutual labels:  polyfill
temps-lite
A smart, good-looking little app which tries to speak your language the way you are used to.
Stars: ✭ 40 (-56.52%)
Mutual labels:  time
colored-console
🌈 Add some color to your console >_
Stars: ✭ 74 (-19.57%)
Mutual labels:  console
kronos
Management of arithmetic operations on dates
Stars: ✭ 23 (-75%)
Mutual labels:  time
PHPUnit-Polyfills
Set of polyfills for changed PHPUnit functionality to allow for creating PHPUnit cross-version compatible tests
Stars: ✭ 147 (+59.78%)
Mutual labels:  polyfill
tty-screen
Terminal screen detection - cross platform, major ruby interpreters
Stars: ✭ 78 (-15.22%)
Mutual labels:  console
time machine
A date and time API for Dart
Stars: ✭ 120 (+30.43%)
Mutual labels:  time
xd-plugin
Inker8 plugin for Adobe XD
Stars: ✭ 35 (-61.96%)
Mutual labels:  measurements
console-web-ui
Examples to show case how to build web based UI (that can be invoked using curl) for console applications using Javascript(NodeJS)
Stars: ✭ 28 (-69.57%)
Mutual labels:  console
scala-js-momentjs
Scala.js façade for Moment.js
Stars: ✭ 45 (-51.09%)
Mutual labels:  time
strip-ansi-stream
Strip ANSI escape codes
Stars: ✭ 32 (-65.22%)
Mutual labels:  console
draggable-polyfill
🌈a beautify polyfill for native drag!
Stars: ✭ 49 (-46.74%)
Mutual labels:  polyfill
TimeContinuum
No description or website provided.
Stars: ✭ 28 (-69.57%)
Mutual labels:  time
t-rex-game-bot
A bot that plays the Google Chrome T-Rex game for you
Stars: ✭ 60 (-34.78%)
Mutual labels:  console

react-native-console-time-polyfill

Starts a timer you can use to track how long an operation takes. When you call console.timeEnd()/console.timeLog() with the same name, the react-native will output the time, in milliseconds, that elapsed since the timer was started.

Also you can use console.count() and console.countReset() for determine number of function calls.

Installation

Install library from npm

npm install --save react-native-console-time-polyfill

or yarn

yarn add react-native-console-time-polyfill

Syntax

console.time(label);
console.timeLog(label);
console.timeEnd(label);

console.count(label);
console.countReset(label);

Parameters

label

The name to give the new timer or counter. This will identify the timer or counter.

Use the same name when calling console.timeEnd() to stop the timer and get the time output to the console.

Usage

Use the following code:

// in your root javascript file
import 'react-native-console-time-polyfill';

// now you can use polyfill in your components
class Example extends Component {
  constructor(props) {
    super(props);

    console.time(`${this.constructor.name} init`);
    // "some slow initializaton code"
    console.timeEnd(`${this.constructor.name} init`);
  }

  componentWillUnmount() {
    console.countReset(`${this.constructor.name}.render calls`);
  }

  render() {
    console.count(`${this.constructor.name}.render calls`);
    return (
      <Text>some text</Text>;
    );
  }
}

Output

Example init: 200ms
Example.render calls: 2
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].