All Projects → EddyVerbruggen → nativescript-performance-monitor

EddyVerbruggen / nativescript-performance-monitor

Licence: other
⚡ Proof your app maintains 60-ish FPS by collecting data or showing it on screen with this NativeScript plugin!

Programming Languages

typescript
32286 projects
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to nativescript-performance-monitor

nativescript-taptic-engine
📳 Use Apple's Taptic Engine to vibrate your iPhone 6s (and up) in a variety of ways
Stars: ✭ 16 (-23.81%)
Mutual labels:  nativescript, nativescript-plugin
nativescript-drawingpad
📝 NativeScript plugin to provide a way to capture any drawing (signatures are a common use case) from the device
Stars: ✭ 89 (+323.81%)
Mutual labels:  nativescript, nativescript-plugin
nativescript-vue-examples
🍈 NativeScript and Vue code samples.
Stars: ✭ 13 (-38.1%)
Mutual labels:  nativescript, nativescript-plugin
nativescript-apple-sign-in
Sign In With Apple, as seen on WWDC 2019, available with iOS 13
Stars: ✭ 37 (+76.19%)
Mutual labels:  nativescript, nativescript-plugin
nativescript-http
The best way to do HTTP requests in NativeScript, a drop-in replacement for the core HTTP with important improvements and additions like proper connection pooling, form data support and certificate pinning
Stars: ✭ 32 (+52.38%)
Mutual labels:  nativescript, nativescript-plugin
nativescript-app-icon-changer
Change the homescreen icon of your NativeScript iOS app at runtime!
Stars: ✭ 16 (-23.81%)
Mutual labels:  nativescript, nativescript-plugin
nativescript-star-printer
🌟 Print directly to Star Micronics printers from your NativeScript app! http://www.starmicronics.com/
Stars: ✭ 28 (+33.33%)
Mutual labels:  nativescript, nativescript-plugin
nativescript-ng-shadow
Angular directive to apply shadows to native elements according to the elevation level guidelines of material design specification
Stars: ✭ 54 (+157.14%)
Mutual labels:  nativescript, nativescript-plugin
insomnia
😪 NativeScript plugin to keep the device awake (not dim the screen, lock, etc)
Stars: ✭ 40 (+90.48%)
Mutual labels:  nativescript, nativescript-plugin
WMDebugAssistant
CPU 内存(Memory)Network FPS 实时监测 查看沙盒sandbox
Stars: ✭ 52 (+147.62%)
Mutual labels:  cpu, fps
nativescript-menu
A plugin that adds a pop-up menu to NativeScript
Stars: ✭ 17 (-19.05%)
Mutual labels:  nativescript, nativescript-plugin
ui
Add right-to-left support to the NativeScript framework
Stars: ✭ 22 (+4.76%)
Mutual labels:  nativescript, nativescript-plugin
texttospeech
Text to Speech NativeScript plugin for Android & iOS 📢
Stars: ✭ 44 (+109.52%)
Mutual labels:  nativescript, nativescript-plugin
nativescript-pushy
Easy push notifications for your NativeScript app!
Stars: ✭ 19 (-9.52%)
Mutual labels:  nativescript, nativescript-plugin
nativescript-image-filters
NativeScript plugin to apply filters to images
Stars: ✭ 30 (+42.86%)
Mutual labels:  nativescript, nativescript-plugin
nativescript-clipboard
📋 NativeScript plugin to copy stuff to the device clipboard, and read from it again
Stars: ✭ 40 (+90.48%)
Mutual labels:  nativescript, nativescript-plugin
Ios Monitor Platform
📚 iOS 性能监控 SDK —— Wedjat(华狄特)开发过程的调研和整理
Stars: ✭ 2,316 (+10928.57%)
Mutual labels:  cpu, fps
nativescript-store-update
No description or website provided.
Stars: ✭ 18 (-14.29%)
Mutual labels:  nativescript, nativescript-plugin
nativescript-appversion
🔢 NativeScript plugin to retrieve your app's package ID and current version
Stars: ✭ 47 (+123.81%)
Mutual labels:  nativescript, nativescript-plugin
nativescript-app-shortcuts
👇 Home Icon Actions for your NativeScript app, now also for Android!
Stars: ✭ 45 (+114.29%)
Mutual labels:  nativescript, nativescript-plugin

NativeScript Performance Monitor

Measure and show FPS and (on iOS) CPU usage!

Demo video on YouTube

20 sec video, showing off the plugin on iOS and Android

Installation

From the command prompt go to your app's root folder and execute:

tns plugin add nativescript-performance-monitor

Start monitoring

After adding the plugin you can start monitoring from code. There are a few options you can pass in as well (the options object itself is optional as well):

Option iOS? Android? Description
onSample? A callback function that gets invoked on every sample. If you don't want to use the default UI of this plugin you can use this to render your own UI. See the examples below for the function spec.
hide? Set to true if you don't want the default UI to show. So roll your own or go ito stealth mode entirely.
textColor? The text color of the monitor view (default white).
backgroundColor? ◻️ Background color of the monitor view (default black).
borderColor? ◻️ The border color of the monitor view (default black).

TypeScript

import { PerformanceMonitor, PerformanceMonitorSample } from 'nativescript-performance-monitor';
import { Color } from "color";

const performanceMonitor: PerformanceMonitor = new PerformanceMonitor();

// this would suffice..
performanceMonitor.start();

// .. but we want to show off the options ;)
performanceMonitor.start({
  textColor: new Color("white"),
  backgroundColor: new Color("black"),
  borderColor: new Color("black"),
  hide: false,
  onSample: (sample: PerformanceMonitorSample) => {
    console.log("FPS: " + sample.fps);
    if (sample.cpu) { // iOS only
      console.log("CPU %: " + sample.cpu);
    }
  }
});

JavaScript

var perfMon = require("nativescript-performance-monitor");
var color = require("color");

var performanceMonitor = new perfMon.PerformanceMonitor();

performanceMonitor.start({
  textColor: new color.Color("white"),
  backgroundColor: new color.Color("black"),
  borderColor: new color.Color("black"),
  hide: false,
  onSample: function (sample) {
    console.log("FPS: " + sample.fps);
    if (sample.cpu) { // iOS only
      console.log("CPU %: " + sample.cpu);
    }
  }
});

Stop monitoring

To stop receiving measurements and hide the monitor UI you can simply do this:

performanceMonitor.stop();

Usage with Angular

In any component, or even app.module.ts add:

import { PerformanceMonitor } from "nativescript-performance-monitor";

export class MyComponent {
  // use the constructor, or OnInit, or trigger from a button, or whatever really
  constructor() {
    new PerformanceMonitor().start({
      // options
    });
  }
}

Known issues (Android)

  • May crash when a Toast is shown on newer Android versions while you're using the default UI.
  • UI will hide when app is pauzed / resumed.
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].