├── .gitignore
├── .npmignore
├── LICENSE
├── README.md
├── demo
├── app
│ ├── App_Resources
│ │ ├── Android
│ │ │ ├── app.gradle
│ │ │ └── src
│ │ │ │ └── main
│ │ │ │ ├── AndroidManifest.xml
│ │ │ │ └── res
│ │ │ │ ├── drawable-hdpi
│ │ │ │ ├── background.png
│ │ │ │ ├── icon.png
│ │ │ │ └── logo.png
│ │ │ │ ├── drawable-ldpi
│ │ │ │ ├── background.png
│ │ │ │ ├── icon.png
│ │ │ │ └── logo.png
│ │ │ │ ├── drawable-mdpi
│ │ │ │ ├── background.png
│ │ │ │ ├── icon.png
│ │ │ │ └── logo.png
│ │ │ │ ├── drawable-nodpi
│ │ │ │ └── splash_screen.xml
│ │ │ │ ├── drawable-xhdpi
│ │ │ │ ├── background.png
│ │ │ │ ├── icon.png
│ │ │ │ └── logo.png
│ │ │ │ ├── drawable-xxhdpi
│ │ │ │ ├── background.png
│ │ │ │ ├── icon.png
│ │ │ │ └── logo.png
│ │ │ │ ├── drawable-xxxhdpi
│ │ │ │ ├── background.png
│ │ │ │ ├── icon.png
│ │ │ │ └── logo.png
│ │ │ │ ├── values-v21
│ │ │ │ ├── colors.xml
│ │ │ │ └── styles.xml
│ │ │ │ └── values
│ │ │ │ ├── colors.xml
│ │ │ │ └── styles.xml
│ │ └── iOS
│ │ │ ├── Assets.xcassets
│ │ │ ├── AppIcon.appiconset
│ │ │ │ ├── Contents.json
│ │ │ │ ├── icon-29.png
│ │ │ │ ├── icon-29@2x.png
│ │ │ │ ├── icon-29@3x.png
│ │ │ │ ├── icon-40.png
│ │ │ │ ├── icon-40@2x.png
│ │ │ │ ├── icon-40@3x.png
│ │ │ │ ├── icon-50.png
│ │ │ │ ├── icon-50@2x.png
│ │ │ │ ├── icon-57.png
│ │ │ │ ├── icon-57@2x.png
│ │ │ │ ├── icon-60@2x.png
│ │ │ │ ├── icon-60@3x.png
│ │ │ │ ├── icon-72.png
│ │ │ │ ├── icon-72@2x.png
│ │ │ │ ├── icon-76.png
│ │ │ │ ├── icon-76@2x.png
│ │ │ │ └── icon-83.5@2x.png
│ │ │ ├── Contents.json
│ │ │ ├── LaunchImage.launchimage
│ │ │ │ ├── Contents.json
│ │ │ │ ├── Default-568h@2x.png
│ │ │ │ ├── Default-667h@2x.png
│ │ │ │ ├── Default-736h@3x.png
│ │ │ │ ├── Default-Landscape.png
│ │ │ │ ├── Default-Landscape@2x.png
│ │ │ │ ├── Default-Landscape@3x.png
│ │ │ │ ├── Default-Portrait.png
│ │ │ │ ├── Default-Portrait@2x.png
│ │ │ │ ├── Default.png
│ │ │ │ └── Default@2x.png
│ │ │ ├── LaunchScreen.AspectFill.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ ├── LaunchScreen-AspectFill.png
│ │ │ │ └── LaunchScreen-AspectFill@2x.png
│ │ │ └── LaunchScreen.Center.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ ├── LaunchScreen-Center.png
│ │ │ │ └── LaunchScreen-Center@2x.png
│ │ │ ├── Info.plist
│ │ │ ├── LaunchScreen.storyboard
│ │ │ └── build.xcconfig
│ ├── app.css
│ ├── app.ts
│ ├── main-page.ts
│ ├── main-page.xml
│ ├── main-view-model.ts
│ ├── package.json
│ └── tests
│ │ └── tests.js
├── karma.conf.js
├── package-lock.json
├── package.json
├── tsconfig.json
└── tsconfig.tns.json
├── index.d.ts
├── package-lock.json
├── package.json
├── performance-monitor.android.d.ts
├── performance-monitor.android.ts
├── performance-monitor.common.d.ts
├── performance-monitor.common.ts
├── performance-monitor.ios.d.ts
├── performance-monitor.ios.ts
├── platforms
├── android
│ └── include.gradle
└── ios
│ ├── Podfile
│ └── typings
│ └── objc!GDPerformanceView.d.ts
├── references.d.ts
└── tsconfig.json
/.gitignore:
--------------------------------------------------------------------------------
1 | .idea
2 | .vscode
3 | *.js
4 | *.js.map
5 | *.log
6 | !scripts/*.js
7 | demo/app/*.js
8 | !demo/karma.conf.js
9 | !demo/app/tests/*.js
10 | demo/*.d.ts
11 | demo/lib
12 | demo/platforms
13 | demo/node_modules
14 | node_modules
--------------------------------------------------------------------------------
/.npmignore:
--------------------------------------------------------------------------------
1 | .idea
2 | .vscode
3 | demo/
4 | screenshots/
5 | *.gif
6 | *.png
7 | *.log
8 | *.map
9 | *.ts
10 | !*.d.ts
11 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | nativescript-performance-monitor
4 | Copyright (c) 2017, Eddy Verbruggen
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy of
7 | this software and associated documentation files (the "Software"), to deal in
8 | the Software without restriction, including without limitation the rights to
9 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
10 | the Software, and to permit persons to whom the Software is furnished to do so,
11 | subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in all
14 | copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
18 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
19 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
20 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # NativeScript Performance Monitor
2 | Measure and show FPS and (on iOS) CPU usage!
3 |
4 | [](https://www.youtube.com/watch?v=qeqWDWCYbvY)
5 |
6 | _20 sec video, showing off the plugin on iOS and Android_
7 |
8 | ## Installation
9 | From the command prompt go to your app's root folder and execute:
10 |
11 | ```
12 | tns plugin add nativescript-performance-monitor
13 | ```
14 |
15 | ## Start monitoring
16 | 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):
17 |
18 | | Option | iOS? | Android? | Description
19 | --- | --- | --- | ---
20 | | `onSample?` | :white_check_mark: | :white_check_mark: | 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.
21 | | `hide?` | :white_check_mark: | :white_check_mark: | Set to `true` if you don't want the default UI to show. So roll your own or go ito stealth mode entirely.
22 | | `textColor?` | :white_check_mark: | :white_check_mark: | The text color of the monitor view (default white).
23 | | `backgroundColor?` | :white_check_mark: | :white_medium_square: | Background color of the monitor view (default black).
24 | | `borderColor?` | :white_check_mark: | :white_medium_square: | The border color of the monitor view (default black).
25 |
26 | ### TypeScript
27 |
28 | ```js
29 | import { PerformanceMonitor, PerformanceMonitorSample } from 'nativescript-performance-monitor';
30 | import { Color } from "color";
31 |
32 | const performanceMonitor: PerformanceMonitor = new PerformanceMonitor();
33 |
34 | // this would suffice..
35 | performanceMonitor.start();
36 |
37 | // .. but we want to show off the options ;)
38 | performanceMonitor.start({
39 | textColor: new Color("white"),
40 | backgroundColor: new Color("black"),
41 | borderColor: new Color("black"),
42 | hide: false,
43 | onSample: (sample: PerformanceMonitorSample) => {
44 | console.log("FPS: " + sample.fps);
45 | if (sample.cpu) { // iOS only
46 | console.log("CPU %: " + sample.cpu);
47 | }
48 | }
49 | });
50 | ```
51 |
52 | ### JavaScript
53 |
54 | ```js
55 | var perfMon = require("nativescript-performance-monitor");
56 | var color = require("color");
57 |
58 | var performanceMonitor = new perfMon.PerformanceMonitor();
59 |
60 | performanceMonitor.start({
61 | textColor: new color.Color("white"),
62 | backgroundColor: new color.Color("black"),
63 | borderColor: new color.Color("black"),
64 | hide: false,
65 | onSample: function (sample) {
66 | console.log("FPS: " + sample.fps);
67 | if (sample.cpu) { // iOS only
68 | console.log("CPU %: " + sample.cpu);
69 | }
70 | }
71 | });
72 | ```
73 |
74 | ## Stop monitoring
75 | To stop receiving measurements and hide the monitor UI you can simply do this:
76 |
77 | ```js
78 | performanceMonitor.stop();
79 | ```
80 |
81 | ## Usage with Angular
82 | In any component, or even `app.module.ts` add:
83 |
84 | ```js
85 | import { PerformanceMonitor } from "nativescript-performance-monitor";
86 |
87 | export class MyComponent {
88 | // use the constructor, or OnInit, or trigger from a button, or whatever really
89 | constructor() {
90 | new PerformanceMonitor().start({
91 | // options
92 | });
93 | }
94 | }
95 | ```
96 |
97 | ## Known issues (Android)
98 | - May crash when a Toast is shown on newer Android versions while you're using the default UI.
99 | - UI will hide when app is pauzed / resumed.
100 |
101 |
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/app.gradle:
--------------------------------------------------------------------------------
1 | android {
2 | defaultConfig {
3 | generatedDensities = []
4 | applicationId = "org.nativescript.starter"
5 | }
6 | aaptOptions {
7 | additionalParameters "--no-version-vectors"
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
16 |
17 |
18 |
19 |
20 |
21 |
27 |
28 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/src/main/res/drawable-hdpi/background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-performance-monitor/aa4fdae8bfbb9c75dea622dfcd844dffdd5bf890/demo/app/App_Resources/Android/src/main/res/drawable-hdpi/background.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/src/main/res/drawable-hdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-performance-monitor/aa4fdae8bfbb9c75dea622dfcd844dffdd5bf890/demo/app/App_Resources/Android/src/main/res/drawable-hdpi/icon.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/src/main/res/drawable-hdpi/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-performance-monitor/aa4fdae8bfbb9c75dea622dfcd844dffdd5bf890/demo/app/App_Resources/Android/src/main/res/drawable-hdpi/logo.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/src/main/res/drawable-ldpi/background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-performance-monitor/aa4fdae8bfbb9c75dea622dfcd844dffdd5bf890/demo/app/App_Resources/Android/src/main/res/drawable-ldpi/background.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/src/main/res/drawable-ldpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-performance-monitor/aa4fdae8bfbb9c75dea622dfcd844dffdd5bf890/demo/app/App_Resources/Android/src/main/res/drawable-ldpi/icon.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/src/main/res/drawable-ldpi/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-performance-monitor/aa4fdae8bfbb9c75dea622dfcd844dffdd5bf890/demo/app/App_Resources/Android/src/main/res/drawable-ldpi/logo.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/src/main/res/drawable-mdpi/background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-performance-monitor/aa4fdae8bfbb9c75dea622dfcd844dffdd5bf890/demo/app/App_Resources/Android/src/main/res/drawable-mdpi/background.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/src/main/res/drawable-mdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-performance-monitor/aa4fdae8bfbb9c75dea622dfcd844dffdd5bf890/demo/app/App_Resources/Android/src/main/res/drawable-mdpi/icon.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/src/main/res/drawable-mdpi/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-performance-monitor/aa4fdae8bfbb9c75dea622dfcd844dffdd5bf890/demo/app/App_Resources/Android/src/main/res/drawable-mdpi/logo.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/src/main/res/drawable-nodpi/splash_screen.xml:
--------------------------------------------------------------------------------
1 |
2 | -
3 |
4 |
5 | -
6 |
7 |
8 |
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/src/main/res/drawable-xhdpi/background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-performance-monitor/aa4fdae8bfbb9c75dea622dfcd844dffdd5bf890/demo/app/App_Resources/Android/src/main/res/drawable-xhdpi/background.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/src/main/res/drawable-xhdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-performance-monitor/aa4fdae8bfbb9c75dea622dfcd844dffdd5bf890/demo/app/App_Resources/Android/src/main/res/drawable-xhdpi/icon.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/src/main/res/drawable-xhdpi/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-performance-monitor/aa4fdae8bfbb9c75dea622dfcd844dffdd5bf890/demo/app/App_Resources/Android/src/main/res/drawable-xhdpi/logo.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/src/main/res/drawable-xxhdpi/background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-performance-monitor/aa4fdae8bfbb9c75dea622dfcd844dffdd5bf890/demo/app/App_Resources/Android/src/main/res/drawable-xxhdpi/background.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/src/main/res/drawable-xxhdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-performance-monitor/aa4fdae8bfbb9c75dea622dfcd844dffdd5bf890/demo/app/App_Resources/Android/src/main/res/drawable-xxhdpi/icon.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/src/main/res/drawable-xxhdpi/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-performance-monitor/aa4fdae8bfbb9c75dea622dfcd844dffdd5bf890/demo/app/App_Resources/Android/src/main/res/drawable-xxhdpi/logo.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-performance-monitor/aa4fdae8bfbb9c75dea622dfcd844dffdd5bf890/demo/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/background.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-performance-monitor/aa4fdae8bfbb9c75dea622dfcd844dffdd5bf890/demo/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/icon.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-performance-monitor/aa4fdae8bfbb9c75dea622dfcd844dffdd5bf890/demo/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/logo.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/src/main/res/values-v21/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3d5afe
4 |
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
9 |
10 |
11 |
14 |
15 |
16 |
19 |
20 |
23 |
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #F5F5F5
4 | #757575
5 | #33B5E5
6 | #272734
7 |
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
18 |
19 |
21 |
22 |
23 |
31 |
32 |
34 |
35 |
36 |
42 |
43 |
45 |
46 |
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "29x29",
5 | "idiom" : "iphone",
6 | "filename" : "icon-29.png",
7 | "scale" : "1x"
8 | },
9 | {
10 | "size" : "29x29",
11 | "idiom" : "iphone",
12 | "filename" : "icon-29@2x.png",
13 | "scale" : "2x"
14 | },
15 | {
16 | "size" : "29x29",
17 | "idiom" : "iphone",
18 | "filename" : "icon-29@3x.png",
19 | "scale" : "3x"
20 | },
21 | {
22 | "size" : "40x40",
23 | "idiom" : "iphone",
24 | "filename" : "icon-40@2x.png",
25 | "scale" : "2x"
26 | },
27 | {
28 | "size" : "40x40",
29 | "idiom" : "iphone",
30 | "filename" : "icon-40@3x.png",
31 | "scale" : "3x"
32 | },
33 | {
34 | "size" : "57x57",
35 | "idiom" : "iphone",
36 | "filename" : "icon-57.png",
37 | "scale" : "1x"
38 | },
39 | {
40 | "size" : "57x57",
41 | "idiom" : "iphone",
42 | "filename" : "icon-57@2x.png",
43 | "scale" : "2x"
44 | },
45 | {
46 | "size" : "60x60",
47 | "idiom" : "iphone",
48 | "filename" : "icon-60@2x.png",
49 | "scale" : "2x"
50 | },
51 | {
52 | "size" : "60x60",
53 | "idiom" : "iphone",
54 | "filename" : "icon-60@3x.png",
55 | "scale" : "3x"
56 | },
57 | {
58 | "size" : "29x29",
59 | "idiom" : "ipad",
60 | "filename" : "icon-29.png",
61 | "scale" : "1x"
62 | },
63 | {
64 | "size" : "29x29",
65 | "idiom" : "ipad",
66 | "filename" : "icon-29@2x.png",
67 | "scale" : "2x"
68 | },
69 | {
70 | "size" : "40x40",
71 | "idiom" : "ipad",
72 | "filename" : "icon-40.png",
73 | "scale" : "1x"
74 | },
75 | {
76 | "size" : "40x40",
77 | "idiom" : "ipad",
78 | "filename" : "icon-40@2x.png",
79 | "scale" : "2x"
80 | },
81 | {
82 | "size" : "50x50",
83 | "idiom" : "ipad",
84 | "filename" : "icon-50.png",
85 | "scale" : "1x"
86 | },
87 | {
88 | "size" : "50x50",
89 | "idiom" : "ipad",
90 | "filename" : "icon-50@2x.png",
91 | "scale" : "2x"
92 | },
93 | {
94 | "size" : "72x72",
95 | "idiom" : "ipad",
96 | "filename" : "icon-72.png",
97 | "scale" : "1x"
98 | },
99 | {
100 | "size" : "72x72",
101 | "idiom" : "ipad",
102 | "filename" : "icon-72@2x.png",
103 | "scale" : "2x"
104 | },
105 | {
106 | "size" : "76x76",
107 | "idiom" : "ipad",
108 | "filename" : "icon-76.png",
109 | "scale" : "1x"
110 | },
111 | {
112 | "size" : "76x76",
113 | "idiom" : "ipad",
114 | "filename" : "icon-76@2x.png",
115 | "scale" : "2x"
116 | },
117 | {
118 | "size" : "83.5x83.5",
119 | "idiom" : "ipad",
120 | "filename" : "icon-83.5@2x.png",
121 | "scale" : "2x"
122 | }
123 | ],
124 | "info" : {
125 | "version" : 1,
126 | "author" : "xcode"
127 | }
128 | }
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-performance-monitor/aa4fdae8bfbb9c75dea622dfcd844dffdd5bf890/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-performance-monitor/aa4fdae8bfbb9c75dea622dfcd844dffdd5bf890/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-performance-monitor/aa4fdae8bfbb9c75dea622dfcd844dffdd5bf890/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-performance-monitor/aa4fdae8bfbb9c75dea622dfcd844dffdd5bf890/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-performance-monitor/aa4fdae8bfbb9c75dea622dfcd844dffdd5bf890/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-performance-monitor/aa4fdae8bfbb9c75dea622dfcd844dffdd5bf890/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-performance-monitor/aa4fdae8bfbb9c75dea622dfcd844dffdd5bf890/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-performance-monitor/aa4fdae8bfbb9c75dea622dfcd844dffdd5bf890/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-performance-monitor/aa4fdae8bfbb9c75dea622dfcd844dffdd5bf890/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-performance-monitor/aa4fdae8bfbb9c75dea622dfcd844dffdd5bf890/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-performance-monitor/aa4fdae8bfbb9c75dea622dfcd844dffdd5bf890/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-performance-monitor/aa4fdae8bfbb9c75dea622dfcd844dffdd5bf890/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-performance-monitor/aa4fdae8bfbb9c75dea622dfcd844dffdd5bf890/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-performance-monitor/aa4fdae8bfbb9c75dea622dfcd844dffdd5bf890/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-performance-monitor/aa4fdae8bfbb9c75dea622dfcd844dffdd5bf890/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-performance-monitor/aa4fdae8bfbb9c75dea622dfcd844dffdd5bf890/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-performance-monitor/aa4fdae8bfbb9c75dea622dfcd844dffdd5bf890/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "extent" : "full-screen",
5 | "idiom" : "iphone",
6 | "subtype" : "736h",
7 | "filename" : "Default-736h@3x.png",
8 | "minimum-system-version" : "8.0",
9 | "orientation" : "portrait",
10 | "scale" : "3x"
11 | },
12 | {
13 | "extent" : "full-screen",
14 | "idiom" : "iphone",
15 | "subtype" : "736h",
16 | "filename" : "Default-Landscape@3x.png",
17 | "minimum-system-version" : "8.0",
18 | "orientation" : "landscape",
19 | "scale" : "3x"
20 | },
21 | {
22 | "extent" : "full-screen",
23 | "idiom" : "iphone",
24 | "subtype" : "667h",
25 | "filename" : "Default-667h@2x.png",
26 | "minimum-system-version" : "8.0",
27 | "orientation" : "portrait",
28 | "scale" : "2x"
29 | },
30 | {
31 | "orientation" : "portrait",
32 | "idiom" : "iphone",
33 | "filename" : "Default@2x.png",
34 | "extent" : "full-screen",
35 | "minimum-system-version" : "7.0",
36 | "scale" : "2x"
37 | },
38 | {
39 | "extent" : "full-screen",
40 | "idiom" : "iphone",
41 | "subtype" : "retina4",
42 | "filename" : "Default-568h@2x.png",
43 | "minimum-system-version" : "7.0",
44 | "orientation" : "portrait",
45 | "scale" : "2x"
46 | },
47 | {
48 | "orientation" : "portrait",
49 | "idiom" : "ipad",
50 | "filename" : "Default-Portrait.png",
51 | "extent" : "full-screen",
52 | "minimum-system-version" : "7.0",
53 | "scale" : "1x"
54 | },
55 | {
56 | "orientation" : "landscape",
57 | "idiom" : "ipad",
58 | "filename" : "Default-Landscape.png",
59 | "extent" : "full-screen",
60 | "minimum-system-version" : "7.0",
61 | "scale" : "1x"
62 | },
63 | {
64 | "orientation" : "portrait",
65 | "idiom" : "ipad",
66 | "filename" : "Default-Portrait@2x.png",
67 | "extent" : "full-screen",
68 | "minimum-system-version" : "7.0",
69 | "scale" : "2x"
70 | },
71 | {
72 | "orientation" : "landscape",
73 | "idiom" : "ipad",
74 | "filename" : "Default-Landscape@2x.png",
75 | "extent" : "full-screen",
76 | "minimum-system-version" : "7.0",
77 | "scale" : "2x"
78 | },
79 | {
80 | "orientation" : "portrait",
81 | "idiom" : "iphone",
82 | "filename" : "Default.png",
83 | "extent" : "full-screen",
84 | "scale" : "1x"
85 | },
86 | {
87 | "orientation" : "portrait",
88 | "idiom" : "iphone",
89 | "filename" : "Default@2x.png",
90 | "extent" : "full-screen",
91 | "scale" : "2x"
92 | },
93 | {
94 | "orientation" : "portrait",
95 | "idiom" : "iphone",
96 | "filename" : "Default-568h@2x.png",
97 | "extent" : "full-screen",
98 | "subtype" : "retina4",
99 | "scale" : "2x"
100 | },
101 | {
102 | "orientation" : "portrait",
103 | "idiom" : "ipad",
104 | "extent" : "to-status-bar",
105 | "scale" : "1x"
106 | },
107 | {
108 | "orientation" : "portrait",
109 | "idiom" : "ipad",
110 | "filename" : "Default-Portrait.png",
111 | "extent" : "full-screen",
112 | "scale" : "1x"
113 | },
114 | {
115 | "orientation" : "landscape",
116 | "idiom" : "ipad",
117 | "extent" : "to-status-bar",
118 | "scale" : "1x"
119 | },
120 | {
121 | "orientation" : "landscape",
122 | "idiom" : "ipad",
123 | "filename" : "Default-Landscape.png",
124 | "extent" : "full-screen",
125 | "scale" : "1x"
126 | },
127 | {
128 | "orientation" : "portrait",
129 | "idiom" : "ipad",
130 | "extent" : "to-status-bar",
131 | "scale" : "2x"
132 | },
133 | {
134 | "orientation" : "portrait",
135 | "idiom" : "ipad",
136 | "filename" : "Default-Portrait@2x.png",
137 | "extent" : "full-screen",
138 | "scale" : "2x"
139 | },
140 | {
141 | "orientation" : "landscape",
142 | "idiom" : "ipad",
143 | "extent" : "to-status-bar",
144 | "scale" : "2x"
145 | },
146 | {
147 | "orientation" : "landscape",
148 | "idiom" : "ipad",
149 | "filename" : "Default-Landscape@2x.png",
150 | "extent" : "full-screen",
151 | "scale" : "2x"
152 | }
153 | ],
154 | "info" : {
155 | "version" : 1,
156 | "author" : "xcode"
157 | }
158 | }
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-568h@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-performance-monitor/aa4fdae8bfbb9c75dea622dfcd844dffdd5bf890/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-568h@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-667h@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-performance-monitor/aa4fdae8bfbb9c75dea622dfcd844dffdd5bf890/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-667h@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-736h@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-performance-monitor/aa4fdae8bfbb9c75dea622dfcd844dffdd5bf890/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-736h@3x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-performance-monitor/aa4fdae8bfbb9c75dea622dfcd844dffdd5bf890/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-performance-monitor/aa4fdae8bfbb9c75dea622dfcd844dffdd5bf890/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-performance-monitor/aa4fdae8bfbb9c75dea622dfcd844dffdd5bf890/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@3x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-performance-monitor/aa4fdae8bfbb9c75dea622dfcd844dffdd5bf890/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-performance-monitor/aa4fdae8bfbb9c75dea622dfcd844dffdd5bf890/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-performance-monitor/aa4fdae8bfbb9c75dea622dfcd844dffdd5bf890/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-performance-monitor/aa4fdae8bfbb9c75dea622dfcd844dffdd5bf890/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "LaunchScreen-AspectFill.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "filename" : "LaunchScreen-AspectFill@2x.png",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "universal",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-performance-monitor/aa4fdae8bfbb9c75dea622dfcd844dffdd5bf890/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-performance-monitor/aa4fdae8bfbb9c75dea622dfcd844dffdd5bf890/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "LaunchScreen-Center.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "filename" : "LaunchScreen-Center@2x.png",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "universal",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-performance-monitor/aa4fdae8bfbb9c75dea622dfcd844dffdd5bf890/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-performance-monitor/aa4fdae8bfbb9c75dea622dfcd844dffdd5bf890/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | ${PRODUCT_NAME}
9 | CFBundleExecutable
10 | ${EXECUTABLE_NAME}
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | ${PRODUCT_NAME}
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1.0
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIRequiresFullScreen
28 |
29 | UIRequiredDeviceCapabilities
30 |
31 | armv7
32 |
33 | UISupportedInterfaceOrientations
34 |
35 | UIInterfaceOrientationPortrait
36 | UIInterfaceOrientationLandscapeLeft
37 | UIInterfaceOrientationLandscapeRight
38 |
39 | UISupportedInterfaceOrientations~ipad
40 |
41 | UIInterfaceOrientationPortrait
42 | UIInterfaceOrientationPortraitUpsideDown
43 | UIInterfaceOrientationLandscapeLeft
44 | UIInterfaceOrientationLandscapeRight
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/build.xcconfig:
--------------------------------------------------------------------------------
1 | // You can add custom settings here
2 | // for example you can uncomment the following line to force distribution code signing
3 | // CODE_SIGN_IDENTITY = iPhone Distribution
4 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
5 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
6 |
--------------------------------------------------------------------------------
/demo/app/app.css:
--------------------------------------------------------------------------------
1 | Page {
2 | background-color: aliceblue;
3 | }
4 |
5 | .outer {
6 | padding: 40;
7 | }
8 |
9 | .message {
10 | color: #000;
11 | font-size: 20;
12 | horizontal-align: center;
13 | padding:20;
14 | }
15 |
16 | Button {
17 | background-color: #3598db;
18 | color: #ffffff;
19 | padding: 8 16;
20 | margin: 8;
21 | font-size: 14;
22 | border-radius: 4;
23 | }
--------------------------------------------------------------------------------
/demo/app/app.ts:
--------------------------------------------------------------------------------
1 | import * as application from "tns-core-modules/application";
2 |
3 | application.run({moduleName: "main-page"});
4 |
--------------------------------------------------------------------------------
/demo/app/main-page.ts:
--------------------------------------------------------------------------------
1 | import * as observable from "tns-core-modules/data/observable";
2 | import * as pages from "tns-core-modules/ui/page";
3 | import { HelloWorldModel } from "./main-view-model";
4 |
5 | // Event handler for Page 'loaded' event attached in main-page.xml
6 | export function pageLoaded(args: observable.EventData) {
7 | // Get the event sender
8 | let page = args.object;
9 | page.bindingContext = new HelloWorldModel();
10 | }
--------------------------------------------------------------------------------
/demo/app/main-page.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/demo/app/main-view-model.ts:
--------------------------------------------------------------------------------
1 | import { PerformanceMonitor, PerformanceMonitorSample } from "nativescript-performance-monitor";
2 | import { Color } from 'tns-core-modules/color';
3 | import { Observable } from "tns-core-modules/data/observable";
4 |
5 | export class HelloWorldModel extends Observable {
6 | private performanceMonitor: PerformanceMonitor;
7 |
8 | constructor() {
9 | super();
10 | this.performanceMonitor = new PerformanceMonitor();
11 | }
12 |
13 | public onStartTap() {
14 | this.set("active", true);
15 | this.performanceMonitor.start({
16 | textColor: new Color("white"),
17 | backgroundColor: new Color("black"),
18 | borderColor: new Color("black"),
19 | hide: false,
20 | onSample: (sample: PerformanceMonitorSample) => {
21 | this.set("fps", sample.fps);
22 | if (sample.cpu) {
23 | this.set("cpu", sample.cpu);
24 | }
25 | }
26 | });
27 | }
28 |
29 | public onStopTap() {
30 | this.set("active", false);
31 | this.performanceMonitor.stop();
32 | }
33 | }
--------------------------------------------------------------------------------
/demo/app/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "tns-template-hello-world-ts",
3 | "main": "app.js",
4 | "version": "1.6.0",
5 | "author": {
6 | "name": "Telerik",
7 | "email": "support@telerik.com"
8 | },
9 | "description": "Nativescript hello-world-ts project template",
10 | "license": "Apache-2.0",
11 | "keywords": [
12 | "telerik",
13 | "mobile",
14 | "nativescript",
15 | "{N}",
16 | "tns",
17 | "appbuilder",
18 | "template"
19 | ],
20 | "repository": {
21 | "type": "git",
22 | "url": "git+ssh://git@github.com/NativeScript/template-hello-world-ts.git"
23 | },
24 | "bugs": {
25 | "url": "https://github.com/NativeScript/template-hello-world-ts/issues"
26 | },
27 | "homepage": "https://github.com/NativeScript/template-hello-world-ts",
28 | "android": {
29 | "v8Flags": "--expose_gc",
30 | "markingMode": "none"
31 | },
32 | "devDependencies": {
33 | "nativescript-dev-typescript": "^0.3.0"
34 | },
35 | "_id": "tns-template-hello-world-ts@1.6.0",
36 | "_shasum": "a567c2b9a56024818c06596dab9629d155c5b8a8",
37 | "_resolved": "https://registry.npmjs.org/tns-template-hello-world-ts/-/tns-template-hello-world-ts-1.6.0.tgz",
38 | "_from": "tns-template-hello-world-ts@latest",
39 | "scripts": {},
40 | "_npmVersion": "2.14.7",
41 | "_nodeVersion": "4.2.2",
42 | "_npmUser": {
43 | "name": "enchev",
44 | "email": "vladimir.enchev@gmail.com"
45 | },
46 | "dist": {
47 | "shasum": "a567c2b9a56024818c06596dab9629d155c5b8a8",
48 | "tarball": "http://registry.npmjs.org/tns-template-hello-world-ts/-/tns-template-hello-world-ts-1.6.0.tgz"
49 | },
50 | "maintainers": [
51 | {
52 | "name": "enchev",
53 | "email": "vladimir.enchev@gmail.com"
54 | },
55 | {
56 | "name": "erjangavalji",
57 | "email": "erjan.gavalji@gmail.com"
58 | },
59 | {
60 | "name": "fatme",
61 | "email": "hfatme@gmail.com"
62 | },
63 | {
64 | "name": "hdeshev",
65 | "email": "hristo@deshev.com"
66 | },
67 | {
68 | "name": "kerezov",
69 | "email": "d.kerezov@gmail.com"
70 | },
71 | {
72 | "name": "ligaz",
73 | "email": "stefan.dobrev@gmail.com"
74 | },
75 | {
76 | "name": "nsndeck",
77 | "email": "nedyalko.nikolov@telerik.com"
78 | },
79 | {
80 | "name": "rosen-vladimirov",
81 | "email": "rosen.vladimirov.91@gmail.com"
82 | },
83 | {
84 | "name": "sdobrev",
85 | "email": "stefan.dobrev@gmail.com"
86 | },
87 | {
88 | "name": "tailsu",
89 | "email": "tailsu@gmail.com"
90 | },
91 | {
92 | "name": "teobugslayer",
93 | "email": "teobugslayer@gmail.com"
94 | },
95 | {
96 | "name": "valio.stoychev",
97 | "email": "valio.stoychev@gmail.com"
98 | }
99 | ],
100 | "_npmOperationalInternal": {
101 | "host": "packages-5-east.internal.npmjs.com",
102 | "tmp": "tmp/tns-template-hello-world-ts-1.6.0.tgz_1455717516189_0.6427943941671401"
103 | },
104 | "directories": {},
105 | "readme": "ERROR: No README data found!"
106 | }
107 |
--------------------------------------------------------------------------------
/demo/app/tests/tests.js:
--------------------------------------------------------------------------------
1 | var PerfMon = require("nativescript-performance-monitor").PerformanceMonitor;
2 | var performanceMonitor = new PerfMon();
3 |
4 | describe("start", function() {
5 | it("exists", function() {
6 | expect(performanceMonitor.start).toBeDefined();
7 | });
8 |
9 | it("returns a promise", function() {
10 | expect(performanceMonitor.start()).toEqual(jasmine.any(Promise));
11 | });
12 | });
13 |
14 | describe("stop", function() {
15 | it("exists", function() {
16 | expect(performanceMonitor.stop).toBeDefined();
17 | });
18 |
19 | it("returns a promise", function() {
20 | expect(performanceMonitor.stop()).toEqual(jasmine.any(Promise));
21 | });
22 | });
--------------------------------------------------------------------------------
/demo/karma.conf.js:
--------------------------------------------------------------------------------
1 | module.exports = function (config) {
2 | const options = {
3 |
4 | // base path that will be used to resolve all patterns (eg. files, exclude)
5 | basePath: '',
6 |
7 |
8 | // frameworks to use
9 | // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
10 | frameworks: ['jasmine'],
11 |
12 |
13 | // list of files / patterns to load in the browser
14 | files: ['app/tests/**/*.*'],
15 |
16 |
17 | // list of files to exclude
18 | exclude: [
19 | ],
20 |
21 |
22 | // preprocess matching files before serving them to the browser
23 | // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
24 | preprocessors: {
25 | },
26 |
27 |
28 | // test results reporter to use
29 | // possible values: 'dots', 'progress'
30 | // available reporters: https://npmjs.org/browse/keyword/karma-reporter
31 | reporters: ['progress'],
32 |
33 |
34 | // web server port
35 | port: 9876,
36 |
37 |
38 | // enable / disable colors in the output (reporters and logs)
39 | colors: true,
40 |
41 |
42 | // level of logging
43 | // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
44 | logLevel: config.LOG_INFO,
45 |
46 |
47 | // enable / disable watching file and executing tests whenever any file changes
48 | autoWatch: true,
49 |
50 |
51 | // start these browsers
52 | // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
53 | browsers: [],
54 |
55 | customLaunchers: {
56 | android: {
57 | base: 'NS',
58 | platform: 'android'
59 | },
60 | ios: {
61 | base: 'NS',
62 | platform: 'ios'
63 | },
64 | ios_simulator: {
65 | base: 'NS',
66 | platform: 'ios',
67 | arguments: ['--emulator']
68 | }
69 | },
70 |
71 | // Continuous Integration mode
72 | // if true, Karma captures browsers, runs the tests and exits
73 | singleRun: false
74 | };
75 |
76 | setWebpackPreprocessor(config, options);
77 | setWebpack(config, options);
78 |
79 | config.set(options);
80 | }
81 |
82 | function setWebpackPreprocessor(config, options) {
83 | if (config && config.bundle) {
84 | if (!options.preprocessors) {
85 | options.preprocessors = {};
86 | }
87 |
88 | options.files.forEach(file => {
89 | if (!options.preprocessors[file]) {
90 | options.preprocessors[file] = [];
91 | }
92 | options.preprocessors[file].push('webpack');
93 | });
94 | }
95 | }
96 |
97 | function setWebpack(config, options) {
98 | if (config && config.bundle) {
99 | const env = {};
100 | env[config.platform] = true;
101 | env.sourceMap = config.debugBrk;
102 | env.appPath = config.appPath;
103 | options.webpack = require('./webpack.config')(env);
104 | delete options.webpack.entry;
105 | delete options.webpack.output.libraryTarget;
106 | const invalidPluginsForUnitTesting = ["GenerateBundleStarterPlugin", "GenerateNativeScriptEntryPointsPlugin"];
107 | options.webpack.plugins = options.webpack.plugins.filter(p => !invalidPluginsForUnitTesting.includes(p.constructor.name));
108 | }
109 | }
110 |
--------------------------------------------------------------------------------
/demo/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "nativescript": {
3 | "id": "org.nativescript.PerfMon",
4 | "tns-ios": {
5 | "version": "6.2.0"
6 | },
7 | "tns-android": {
8 | "version": "6.2.0"
9 | }
10 | },
11 | "dependencies": {
12 | "nativescript-performance-monitor": "file:..",
13 | "nativescript-unit-test-runner": "0.7.0",
14 | "tns-core-modules": "~6.2.0"
15 | },
16 | "devDependencies": {
17 | "babel-traverse": "6.12.0",
18 | "babel-types": "6.11.1",
19 | "babylon": "6.8.4",
20 | "filewalker": "0.1.2",
21 | "jasmine-core": "^2.5.2",
22 | "karma": "4.1.0",
23 | "karma-jasmine": "2.0.1",
24 | "karma-nativescript-launcher": "^0.4.0",
25 | "lazy": "1.0.11",
26 | "tns-platform-declarations": "~6.2.0",
27 | "typescript": "3.4.5",
28 | "nativescript-dev-webpack": "~1.3.0",
29 | "karma-webpack": "3.0.5"
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/demo/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "module": "commonjs",
5 | "declaration": false,
6 | "removeComments": true,
7 | "noLib": false,
8 | "emitDecoratorMetadata": true,
9 | "experimentalDecorators": true,
10 | "skipLibCheck": true,
11 | "lib": [
12 | "es6",
13 | "dom",
14 | "es2015.iterable"
15 | ],
16 | "pretty": true,
17 | "allowUnreachableCode": false,
18 | "allowUnusedLabels": false,
19 | "noEmitHelpers": true,
20 | "noEmitOnError": false,
21 | "noImplicitAny": false,
22 | "noImplicitReturns": true,
23 | "noImplicitUseStrict": false,
24 | "noFallthroughCasesInSwitch": true,
25 | "typeRoots": [
26 | "./node_modules/@types",
27 | "./node_modules"
28 | ],
29 | "types": [],
30 | "baseUrl": ".",
31 | "paths": {
32 | "*": [
33 | "./node_modules/tns-core-modules/*",
34 | "./node_modules/*"
35 | ],
36 | "~/*": [
37 | "app/*"
38 | ]
39 | }
40 | },
41 | "exclude": [
42 | "node_modules",
43 | "platforms"
44 | ],
45 | "compileOnSave": false
46 | }
--------------------------------------------------------------------------------
/demo/tsconfig.tns.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig",
3 | "compilerOptions": {
4 | "module": "es2015",
5 | "moduleResolution": "node"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/index.d.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * iOS and Android apis should match.
3 | * It doesn't matter if you export `.ios` or `.android`, either one but only one.
4 | */
5 | export * from './performance-monitor.ios';
6 |
7 | // Export any shared classes, constants, etc.
8 | export * from './performance-monitor.common';
--------------------------------------------------------------------------------
/package-lock.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "nativescript-performance-monitor",
3 | "version": "1.1.0",
4 | "lockfileVersion": 1,
5 | "requires": true,
6 | "dependencies": {
7 | "@nativescript/core": {
8 | "version": "6.2.0",
9 | "resolved": "https://registry.npmjs.org/@nativescript/core/-/core-6.2.0.tgz",
10 | "integrity": "sha512-sStXeAhLhCc2kgU5NjquL5VEIKIMrlUZeFvhXfl91aYwBX5h40fVtb9WYS6MIHDYwBntR0V8ciJdCgQ2318zjg==",
11 | "dev": true,
12 | "requires": {
13 | "nativescript-hook": "0.2.5",
14 | "reduce-css-calc": "^2.1.6",
15 | "semver": "6.3.0",
16 | "tns-core-modules-widgets": "6.2.0",
17 | "tslib": "1.10.0"
18 | }
19 | },
20 | "async": {
21 | "version": "0.9.2",
22 | "resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz",
23 | "integrity": "sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0=",
24 | "dev": true
25 | },
26 | "balanced-match": {
27 | "version": "1.0.0",
28 | "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
29 | "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
30 | "dev": true
31 | },
32 | "brace-expansion": {
33 | "version": "1.1.11",
34 | "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
35 | "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
36 | "dev": true,
37 | "requires": {
38 | "balanced-match": "^1.0.0",
39 | "concat-map": "0.0.1"
40 | }
41 | },
42 | "colors": {
43 | "version": "1.4.0",
44 | "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz",
45 | "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==",
46 | "dev": true
47 | },
48 | "concat-map": {
49 | "version": "0.0.1",
50 | "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
51 | "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
52 | "dev": true
53 | },
54 | "css-unit-converter": {
55 | "version": "1.1.1",
56 | "resolved": "https://registry.npmjs.org/css-unit-converter/-/css-unit-converter-1.1.1.tgz",
57 | "integrity": "sha1-2bkoGtz9jO2TW9urqDeGiX9k6ZY=",
58 | "dev": true
59 | },
60 | "cycle": {
61 | "version": "1.0.3",
62 | "resolved": "https://registry.npmjs.org/cycle/-/cycle-1.0.3.tgz",
63 | "integrity": "sha1-IegLK+hYD5i0aPN5QwZisEbDStI=",
64 | "dev": true
65 | },
66 | "deep-equal": {
67 | "version": "0.2.2",
68 | "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-0.2.2.tgz",
69 | "integrity": "sha1-hLdFiW80xoTpjyzg5Cq69Du6AX0=",
70 | "dev": true
71 | },
72 | "eyes": {
73 | "version": "0.1.8",
74 | "resolved": "https://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz",
75 | "integrity": "sha1-Ys8SAjTGg3hdkCNIqADvPgzCC8A=",
76 | "dev": true
77 | },
78 | "fs.realpath": {
79 | "version": "1.0.0",
80 | "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
81 | "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
82 | "dev": true
83 | },
84 | "glob": {
85 | "version": "7.1.6",
86 | "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz",
87 | "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==",
88 | "dev": true,
89 | "requires": {
90 | "fs.realpath": "^1.0.0",
91 | "inflight": "^1.0.4",
92 | "inherits": "2",
93 | "minimatch": "^3.0.4",
94 | "once": "^1.3.0",
95 | "path-is-absolute": "^1.0.0"
96 | }
97 | },
98 | "i": {
99 | "version": "0.3.6",
100 | "resolved": "https://registry.npmjs.org/i/-/i-0.3.6.tgz",
101 | "integrity": "sha1-2WyScyB28HJxG2sQ/X1PZa2O4j0=",
102 | "dev": true
103 | },
104 | "inflight": {
105 | "version": "1.0.6",
106 | "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
107 | "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
108 | "dev": true,
109 | "requires": {
110 | "once": "^1.3.0",
111 | "wrappy": "1"
112 | }
113 | },
114 | "inherits": {
115 | "version": "2.0.4",
116 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
117 | "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
118 | "dev": true
119 | },
120 | "isstream": {
121 | "version": "0.1.2",
122 | "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz",
123 | "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=",
124 | "dev": true
125 | },
126 | "minimatch": {
127 | "version": "3.0.4",
128 | "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
129 | "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
130 | "dev": true,
131 | "requires": {
132 | "brace-expansion": "^1.1.7"
133 | }
134 | },
135 | "minimist": {
136 | "version": "0.0.8",
137 | "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
138 | "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=",
139 | "dev": true
140 | },
141 | "mkdirp": {
142 | "version": "0.5.1",
143 | "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
144 | "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
145 | "dev": true,
146 | "requires": {
147 | "minimist": "0.0.8"
148 | }
149 | },
150 | "mute-stream": {
151 | "version": "0.0.8",
152 | "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz",
153 | "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==",
154 | "dev": true
155 | },
156 | "nativescript-hook": {
157 | "version": "0.2.5",
158 | "resolved": "https://registry.npmjs.org/nativescript-hook/-/nativescript-hook-0.2.5.tgz",
159 | "integrity": "sha512-ciGJtNbtMB2lGv8jAkUripkRjd3g8atX9VYPSt6e8PI6YPiOKeoma3xjcXoW66pFMYpHnfrbp6Mq9U/QtiQrVg==",
160 | "dev": true,
161 | "requires": {
162 | "glob": "^6.0.1",
163 | "mkdirp": "^0.5.1"
164 | },
165 | "dependencies": {
166 | "glob": {
167 | "version": "6.0.4",
168 | "resolved": "https://registry.npmjs.org/glob/-/glob-6.0.4.tgz",
169 | "integrity": "sha1-DwiGD2oVUSey+t1PnOJLGqtuTSI=",
170 | "dev": true,
171 | "requires": {
172 | "inflight": "^1.0.4",
173 | "inherits": "2",
174 | "minimatch": "2 || 3",
175 | "once": "^1.3.0",
176 | "path-is-absolute": "^1.0.0"
177 | }
178 | }
179 | }
180 | },
181 | "ncp": {
182 | "version": "1.0.1",
183 | "resolved": "https://registry.npmjs.org/ncp/-/ncp-1.0.1.tgz",
184 | "integrity": "sha1-0VNn5cuHQyuhF9K/gP30Wuz7QkY=",
185 | "dev": true
186 | },
187 | "once": {
188 | "version": "1.4.0",
189 | "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
190 | "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
191 | "dev": true,
192 | "requires": {
193 | "wrappy": "1"
194 | }
195 | },
196 | "path-is-absolute": {
197 | "version": "1.0.1",
198 | "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
199 | "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
200 | "dev": true
201 | },
202 | "pkginfo": {
203 | "version": "0.4.1",
204 | "resolved": "https://registry.npmjs.org/pkginfo/-/pkginfo-0.4.1.tgz",
205 | "integrity": "sha1-tUGO8EOd5UJfxJlQQtztFPsqhP8=",
206 | "dev": true
207 | },
208 | "postcss-value-parser": {
209 | "version": "3.3.1",
210 | "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz",
211 | "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==",
212 | "dev": true
213 | },
214 | "prompt": {
215 | "version": "1.0.0",
216 | "resolved": "https://registry.npmjs.org/prompt/-/prompt-1.0.0.tgz",
217 | "integrity": "sha1-jlcSPDlquYiJf7Mn/Trtw+c15P4=",
218 | "dev": true,
219 | "requires": {
220 | "colors": "^1.1.2",
221 | "pkginfo": "0.x.x",
222 | "read": "1.0.x",
223 | "revalidator": "0.1.x",
224 | "utile": "0.3.x",
225 | "winston": "2.1.x"
226 | }
227 | },
228 | "read": {
229 | "version": "1.0.7",
230 | "resolved": "https://registry.npmjs.org/read/-/read-1.0.7.tgz",
231 | "integrity": "sha1-s9oZvQUkMal2cdRKQmNK33ELQMQ=",
232 | "dev": true,
233 | "requires": {
234 | "mute-stream": "~0.0.4"
235 | }
236 | },
237 | "reduce-css-calc": {
238 | "version": "2.1.7",
239 | "resolved": "https://registry.npmjs.org/reduce-css-calc/-/reduce-css-calc-2.1.7.tgz",
240 | "integrity": "sha512-fDnlZ+AybAS3C7Q9xDq5y8A2z+lT63zLbynew/lur/IR24OQF5x98tfNwf79mzEdfywZ0a2wpM860FhFfMxZlA==",
241 | "dev": true,
242 | "requires": {
243 | "css-unit-converter": "^1.1.1",
244 | "postcss-value-parser": "^3.3.0"
245 | }
246 | },
247 | "revalidator": {
248 | "version": "0.1.8",
249 | "resolved": "https://registry.npmjs.org/revalidator/-/revalidator-0.1.8.tgz",
250 | "integrity": "sha1-/s5hv6DBtSoga9axgZgYS91SOjs=",
251 | "dev": true
252 | },
253 | "rimraf": {
254 | "version": "2.7.1",
255 | "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz",
256 | "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==",
257 | "dev": true,
258 | "requires": {
259 | "glob": "^7.1.3"
260 | }
261 | },
262 | "semver": {
263 | "version": "6.3.0",
264 | "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
265 | "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
266 | "dev": true
267 | },
268 | "stack-trace": {
269 | "version": "0.0.10",
270 | "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz",
271 | "integrity": "sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA=",
272 | "dev": true
273 | },
274 | "tns-core-modules": {
275 | "version": "6.2.0",
276 | "resolved": "https://registry.npmjs.org/tns-core-modules/-/tns-core-modules-6.2.0.tgz",
277 | "integrity": "sha512-uLBKqGItFTA8XqnUstzZ73lGMB35k3Y7JME122sRN5+uJZuIuW2AIBmuXs2HVBw3Caa1mAlvZ23coaIXKYpcEQ==",
278 | "dev": true,
279 | "requires": {
280 | "@nativescript/core": "6.2.0"
281 | }
282 | },
283 | "tns-core-modules-widgets": {
284 | "version": "6.2.0",
285 | "resolved": "https://registry.npmjs.org/tns-core-modules-widgets/-/tns-core-modules-widgets-6.2.0.tgz",
286 | "integrity": "sha512-p/b2W6ioBsqnn6O1oFJfJC6SxP7yk11Qh7OYb4Bwn/7TTKHxmEhTRyKNe+9CJwTOtZjMsO9nLHyHuUGzZOB0/g==",
287 | "dev": true
288 | },
289 | "tns-platform-declarations": {
290 | "version": "6.2.0",
291 | "resolved": "https://registry.npmjs.org/tns-platform-declarations/-/tns-platform-declarations-6.2.0.tgz",
292 | "integrity": "sha512-9IYYMeVwrREmIdWKOXPwlAj9V2q5hFSJW3EycQhwhcx8ymlu3BbLopdPxmzlz2eaIApkf9brdxH4nhKTOs3LXw==",
293 | "dev": true
294 | },
295 | "tslib": {
296 | "version": "1.10.0",
297 | "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz",
298 | "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==",
299 | "dev": true
300 | },
301 | "typescript": {
302 | "version": "3.4.5",
303 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.4.5.tgz",
304 | "integrity": "sha512-YycBxUb49UUhdNMU5aJ7z5Ej2XGmaIBL0x34vZ82fn3hGvD+bgrMrVDpatgz2f7YxUMJxMkbWxJZeAvDxVe7Vw==",
305 | "dev": true
306 | },
307 | "utile": {
308 | "version": "0.3.0",
309 | "resolved": "https://registry.npmjs.org/utile/-/utile-0.3.0.tgz",
310 | "integrity": "sha1-E1LDQOuCDk2N26A5pPv6oy7U7zo=",
311 | "dev": true,
312 | "requires": {
313 | "async": "~0.9.0",
314 | "deep-equal": "~0.2.1",
315 | "i": "0.3.x",
316 | "mkdirp": "0.x.x",
317 | "ncp": "1.0.x",
318 | "rimraf": "2.x.x"
319 | }
320 | },
321 | "winston": {
322 | "version": "2.1.1",
323 | "resolved": "https://registry.npmjs.org/winston/-/winston-2.1.1.tgz",
324 | "integrity": "sha1-PJNJ0ZYgf9G9/51LxD73JRDjoS4=",
325 | "dev": true,
326 | "requires": {
327 | "async": "~1.0.0",
328 | "colors": "1.0.x",
329 | "cycle": "1.0.x",
330 | "eyes": "0.1.x",
331 | "isstream": "0.1.x",
332 | "pkginfo": "0.3.x",
333 | "stack-trace": "0.0.x"
334 | },
335 | "dependencies": {
336 | "async": {
337 | "version": "1.0.0",
338 | "resolved": "https://registry.npmjs.org/async/-/async-1.0.0.tgz",
339 | "integrity": "sha1-+PwEyjoTeErenhZBr5hXjPvWR6k=",
340 | "dev": true
341 | },
342 | "colors": {
343 | "version": "1.0.3",
344 | "resolved": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz",
345 | "integrity": "sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs=",
346 | "dev": true
347 | },
348 | "pkginfo": {
349 | "version": "0.3.1",
350 | "resolved": "https://registry.npmjs.org/pkginfo/-/pkginfo-0.3.1.tgz",
351 | "integrity": "sha1-Wyn2qB9wcXFC4J52W76rl7T4HiE=",
352 | "dev": true
353 | }
354 | }
355 | },
356 | "wrappy": {
357 | "version": "1.0.2",
358 | "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
359 | "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
360 | "dev": true
361 | }
362 | }
363 | }
364 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "nativescript-performance-monitor",
3 | "version": "1.1.0",
4 | "description": "Measure and show FPS and (on iOS) CPU usage.",
5 | "main": "performance-monitor",
6 | "typings": "index.d.ts",
7 | "nativescript": {
8 | "platforms": {
9 | "android": "2.3.0",
10 | "ios": "2.3.0"
11 | }
12 | },
13 | "scripts": {
14 | "build": "tsc",
15 | "demo.ios": "npm run preparedemo && cd demo && tns emulate ios --device \"iPhone SE\"",
16 | "demo.ios.device": "npm run preparedemo && cd demo && tns run ios",
17 | "demo.android": "npm run preparedemo && cd demo && tns run android",
18 | "test.ios": "cd demo && tns test ios --emulator",
19 | "test.ios.device": "cd demo && tns test ios",
20 | "test.android": "cd demo && tns test android",
21 | "preparedemo": "npm run build && cd demo && tns plugin remove nativescript-performance-monitor && tns plugin add .. && tns install",
22 | "setup": "npm i && cd demo && npm i && cd .. && npm run build && cd demo && tns plugin add .. && cd ..",
23 | "generate.typings.ios": "cd demo && TNS_DEBUG_METADATA_PATH=\"$(pwd)/metadata\" tns build ios && TNS_TYPESCRIPT_DECLARATIONS_PATH=\"$(pwd)/typings\" tns build ios",
24 | "generate.typings.android": "java -jar ../../android-dts-generator/dts-generator/build/libs/dts-generator.jar -input ./classes.jar -output platforms/android/typings/ && rimraf classes.jar"
25 | },
26 | "repository": {
27 | "type": "git",
28 | "url": "https://github.com/EddyVerbruggen/nativescript-performance-monitor.git"
29 | },
30 | "keywords": [
31 | "ecosystem:NativeScript",
32 | "NativeScript",
33 | "iOS",
34 | "Android",
35 | "Performance",
36 | "FPS",
37 | "CPU"
38 | ],
39 | "author": {
40 | "name": "Eddy Verbruggen",
41 | "email": "eddyverbruggen@gmail.com"
42 | },
43 | "bugs": {
44 | "url": "https://github.com/EddyVerbruggen/nativescript-performance-monitor/issues"
45 | },
46 | "license": "MIT",
47 | "homepage": "https://github.com/EddyVerbruggen/nativescript-performance-monitor",
48 | "readmeFilename": "README.md",
49 | "devDependencies": {
50 | "tns-core-modules": "~6.2.0",
51 | "tns-platform-declarations": "~6.2.0",
52 | "typescript": "~3.4.5",
53 | "prompt": "^1.0.0",
54 | "rimraf": "^2.5.0"
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/performance-monitor.android.d.ts:
--------------------------------------------------------------------------------
1 | import { PerformanceMonitorApi, PerformanceMonitorStartOptions } from "./performance-monitor.common";
2 | export declare class PerformanceMonitor implements PerformanceMonitorApi {
3 | start(options?: PerformanceMonitorStartOptions): Promise;
4 | stop(): Promise;
5 | }
6 |
--------------------------------------------------------------------------------
/performance-monitor.android.ts:
--------------------------------------------------------------------------------
1 | import { PerformanceMonitorApi, PerformanceMonitorStartOptions } from "./performance-monitor.common";
2 | import * as appModule from "tns-core-modules/application";
3 |
4 | declare let jp: any;
5 |
6 | /**
7 | * See https://github.com/wasabeef/Takt
8 | */
9 | export class PerformanceMonitor implements PerformanceMonitorApi {
10 |
11 | public start(options?: PerformanceMonitorStartOptions): Promise {
12 | return new Promise((resolve, reject) => {
13 | // needs a little delay on certain devices, otherwise it hides again almost instantly
14 | setTimeout(() => {
15 | let opts = options || {};
16 |
17 | let monitor = jp.wasabeef.takt.Takt.stock(appModule.android.nativeApp);
18 |
19 | // TODO add as option
20 | monitor.seat(jp.wasabeef.takt.Seat.TOP_CENTER);
21 |
22 | if (opts.textColor) {
23 | monitor.color(opts.textColor.android);
24 | }
25 | monitor.size(15.0);
26 | monitor.alpha(0.7);
27 |
28 | if (opts.onSample) {
29 | monitor.listener(new jp.wasabeef.takt.Audience({
30 | heartbeat: function (fps: number) {
31 | opts.onSample({
32 | fps: Math.round(fps * 10) / 10
33 | });
34 | }
35 | }))
36 | }
37 |
38 | if (opts.hide) {
39 | monitor.hide();
40 | }
41 |
42 | monitor.play();
43 | resolve();
44 | }, 3000);
45 | });
46 | }
47 |
48 | public stop(): Promise {
49 | return new Promise((resolve, reject) => {
50 | jp.wasabeef.takt.Takt.finish();
51 | resolve();
52 | });
53 | }
54 | }
--------------------------------------------------------------------------------
/performance-monitor.common.d.ts:
--------------------------------------------------------------------------------
1 | import { Color } from "tns-core-modules/color";
2 | export interface PerformanceMonitorSample {
3 | fps?: number;
4 | cpu?: number;
5 | }
6 | export interface PerformanceMonitorStartOptions {
7 | onSample?: (PerformanceMonitorSample: any) => void;
8 | hide?: boolean;
9 | backgroundColor?: Color;
10 | textColor?: Color;
11 | borderColor?: Color;
12 | }
13 | export interface PerformanceMonitorApi {
14 | start(options?: PerformanceMonitorStartOptions): Promise;
15 | stop(): Promise;
16 | }
17 |
--------------------------------------------------------------------------------
/performance-monitor.common.ts:
--------------------------------------------------------------------------------
1 | import { Color } from "tns-core-modules/color";
2 |
3 | export interface PerformanceMonitorSample {
4 | fps?: number;
5 | cpu?: number;
6 | }
7 |
8 | export interface PerformanceMonitorStartOptions {
9 | onSample?: (PerformanceMonitorSample) => void;
10 | hide?: boolean;
11 | backgroundColor?: Color;
12 | textColor?: Color;
13 | borderColor?: Color;
14 | }
15 |
16 | export interface PerformanceMonitorApi {
17 | start(options?: PerformanceMonitorStartOptions): Promise;
18 | stop(): Promise;
19 | }
--------------------------------------------------------------------------------
/performance-monitor.ios.d.ts:
--------------------------------------------------------------------------------
1 | import { PerformanceMonitorApi, PerformanceMonitorStartOptions } from "./performance-monitor.common";
2 | export declare class PerformanceMonitor implements PerformanceMonitorApi {
3 | private _monitor;
4 | private _delegate;
5 | start(options?: PerformanceMonitorStartOptions): Promise;
6 | stop(): Promise;
7 | }
8 |
--------------------------------------------------------------------------------
/performance-monitor.ios.ts:
--------------------------------------------------------------------------------
1 | import { PerformanceMonitorApi, PerformanceMonitorSample, PerformanceMonitorStartOptions } from "./performance-monitor.common";
2 |
3 | export class PerformanceMonitor implements PerformanceMonitorApi {
4 | private _monitor: GDPerformanceMonitor;
5 | private _delegate: GDPerformanceMonitorDelegate;
6 |
7 | public start(options?: PerformanceMonitorStartOptions): Promise {
8 | return new Promise((resolve, reject) => {
9 | let opts = options || {};
10 | this._monitor = GDPerformanceMonitor.new();
11 |
12 | this._monitor.startMonitoringWithConfiguration((label) => {
13 | if (opts.backgroundColor) {
14 | label.backgroundColor = opts.backgroundColor.ios;
15 | }
16 | if (opts.textColor) {
17 | label.textColor = opts.textColor.ios;
18 | }
19 | if (opts.borderColor) {
20 | label.layer.borderColor = opts.borderColor.ios.CGColor;
21 | }
22 | });
23 |
24 | this._monitor.appVersionHidden = true;
25 | this._monitor.deviceVersionHidden = true;
26 |
27 | if (opts.onSample) {
28 | this._delegate = GDPerformanceMonitorDelegateImpl.initWithOwnerAndCallback(new WeakRef(this), opts.onSample);
29 | this._monitor.delegate = this._delegate;
30 | }
31 |
32 | if (opts.hide) {
33 | this._monitor.hideMonitoring();
34 | }
35 |
36 | resolve();
37 | });
38 | }
39 |
40 | public stop(): Promise {
41 | return new Promise((resolve, reject) => {
42 | if (this._monitor) {
43 | this._monitor.stopMonitoring();
44 | resolve();
45 | } else {
46 | reject();
47 | }
48 | });
49 | }
50 | }
51 |
52 | class GDPerformanceMonitorDelegateImpl extends NSObject implements GDPerformanceMonitorDelegate {
53 | public static ObjCProtocols = [GDPerformanceMonitorDelegate];
54 |
55 | private _owner: WeakRef;
56 | private _callback: (sample: PerformanceMonitorSample) => void;
57 |
58 | public static initWithOwnerAndCallback(owner: WeakRef, callback: (PerformanceMonitorSample) => void): GDPerformanceMonitorDelegateImpl {
59 | let delegate = GDPerformanceMonitorDelegateImpl.new();
60 | delegate._owner = owner;
61 | delegate._callback = callback;
62 | return delegate;
63 | }
64 |
65 | static new(): GDPerformanceMonitorDelegateImpl {
66 | return super.new();
67 | }
68 |
69 | public performanceMonitorDidReportFPSCPU(fps: number, cpu: number) {
70 | if (this._callback && fps >= 0) {
71 | this._callback({
72 | fps: fps,
73 | cpu: Math.round(cpu * 10) / 10
74 | });
75 | }
76 | }
77 | }
--------------------------------------------------------------------------------
/platforms/android/include.gradle:
--------------------------------------------------------------------------------
1 | android {
2 |
3 | }
4 |
5 | dependencies {
6 | compile 'jp.wasabeef:takt:2.0.1'
7 | }
--------------------------------------------------------------------------------
/platforms/ios/Podfile:
--------------------------------------------------------------------------------
1 | pod 'GDPerformanceView', :git => 'https://github.com/EddyVerbruggen/GDPerformanceView.git', :commit => '5d3281f1bb3fb66fa0a3a6ed7ef331eb135ecd17'
2 |
--------------------------------------------------------------------------------
/platforms/ios/typings/objc!GDPerformanceView.d.ts:
--------------------------------------------------------------------------------
1 |
2 | declare class GDMarginLabel extends UILabel {
3 |
4 | static alloc(): GDMarginLabel; // inherited from NSObject
5 |
6 | static appearance(): GDMarginLabel; // inherited from UIAppearance
7 |
8 | static appearanceForTraitCollection(trait: UITraitCollection): GDMarginLabel; // inherited from UIAppearance
9 |
10 | static appearanceForTraitCollectionWhenContainedIn(trait: UITraitCollection, ContainerClass: typeof NSObject): GDMarginLabel; // inherited from UIAppearance
11 |
12 | static appearanceForTraitCollectionWhenContainedInInstancesOfClasses(trait: UITraitCollection, containerTypes: NSArray | typeof NSObject[]): GDMarginLabel; // inherited from UIAppearance
13 |
14 | static appearanceWhenContainedIn(ContainerClass: typeof NSObject): GDMarginLabel; // inherited from UIAppearance
15 |
16 | static appearanceWhenContainedInInstancesOfClasses(containerTypes: NSArray | typeof NSObject[]): GDMarginLabel; // inherited from UIAppearance
17 |
18 | static new(): GDMarginLabel; // inherited from NSObject
19 | }
20 |
21 | declare class GDPerformanceMonitor extends NSObject {
22 |
23 | static alloc(): GDPerformanceMonitor; // inherited from NSObject
24 |
25 | static new(): GDPerformanceMonitor; // inherited from NSObject
26 |
27 | static sharedInstance(): GDPerformanceMonitor;
28 |
29 | appVersionHidden: boolean;
30 |
31 | delegate: GDPerformanceMonitorDelegate;
32 |
33 | deviceVersionHidden: boolean;
34 |
35 | configureStatusBarAppearanceWithPrefersStatusBarHiddenPreferredStatusBarStyle(prefersStatusBarHidden: boolean, preferredStatusBarStyle: number): void;
36 |
37 | configureWithConfiguration(configuration: (p1: UILabel) => void): void;
38 |
39 | hideMonitoring(): void;
40 |
41 | pauseMonitoring(): void;
42 |
43 | startMonitoring(): void;
44 |
45 | startMonitoringWithConfiguration(configuration: (p1: UILabel) => void): void;
46 |
47 | stopMonitoring(): void;
48 | }
49 |
50 | interface GDPerformanceMonitorDelegate extends NSObjectProtocol {
51 |
52 | performanceMonitorDidReportFPSCPU(fpsValue: number, cpuValue: number): void;
53 | }
54 | declare var GDPerformanceMonitorDelegate: {
55 |
56 | prototype: GDPerformanceMonitorDelegate;
57 | };
58 |
59 | declare class GDPerformanceView extends UIWindow {
60 |
61 | static alloc(): GDPerformanceView; // inherited from NSObject
62 |
63 | static appearance(): GDPerformanceView; // inherited from UIAppearance
64 |
65 | static appearanceForTraitCollection(trait: UITraitCollection): GDPerformanceView; // inherited from UIAppearance
66 |
67 | static appearanceForTraitCollectionWhenContainedIn(trait: UITraitCollection, ContainerClass: typeof NSObject): GDPerformanceView; // inherited from UIAppearance
68 |
69 | static appearanceForTraitCollectionWhenContainedInInstancesOfClasses(trait: UITraitCollection, containerTypes: NSArray | typeof NSObject[]): GDPerformanceView; // inherited from UIAppearance
70 |
71 | static appearanceWhenContainedIn(ContainerClass: typeof NSObject): GDPerformanceView; // inherited from UIAppearance
72 |
73 | static appearanceWhenContainedInInstancesOfClasses(containerTypes: NSArray | typeof NSObject[]): GDPerformanceView; // inherited from UIAppearance
74 |
75 | static new(): GDPerformanceView; // inherited from NSObject
76 |
77 | appVersionHidden: boolean;
78 |
79 | deviceVersionHidden: boolean;
80 |
81 | performanceDelegate: GDPerformanceMonitorDelegate;
82 |
83 | preferredStatusBarStyle: UIStatusBarStyle;
84 |
85 | prefersStatusBarHidden: boolean;
86 |
87 | addMonitoringViewAboveStatusBar(): void;
88 |
89 | configureRootViewController(): void;
90 |
91 | hideMonitoring(): void;
92 |
93 | pauseMonitoring(): void;
94 |
95 | resumeMonitoringAndShowMonitoringView(showMonitoringView: boolean): void;
96 |
97 | stopMonitoring(): void;
98 |
99 | textLabel(): UILabel;
100 | }
101 |
102 | declare var GDPerformanceViewVersionNumber: number;
103 |
104 | declare var GDPerformanceViewVersionString: interop.Reference;
105 |
106 | declare class GDWindowViewController extends UIViewController {
107 |
108 | static alloc(): GDWindowViewController; // inherited from NSObject
109 |
110 | static new(): GDWindowViewController; // inherited from NSObject
111 |
112 | configureStatusBarAppearanceWithPrefersStatusBarHiddenPreferredStatusBarStyle(prefersStatusBarHidden: boolean, preferredStatusBarStyle: UIStatusBarStyle): void;
113 | }
114 |
--------------------------------------------------------------------------------
/references.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 | ///
3 |
4 | ///
5 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "module": "commonjs",
5 | "declaration": true,
6 | "removeComments": true,
7 | "noLib": false,
8 | "emitDecoratorMetadata": true,
9 | "experimentalDecorators": true,
10 | "skipLibCheck": true,
11 | "lib": [
12 | "es2016"
13 | ],
14 | "sourceMap": true,
15 | "pretty": true,
16 | "allowUnreachableCode": false,
17 | "allowUnusedLabels": false,
18 | "noEmitHelpers": true,
19 | "noEmitOnError": false,
20 | "noImplicitAny": false,
21 | "noImplicitReturns": true,
22 | "noImplicitUseStrict": false,
23 | "noFallthroughCasesInSwitch": true,
24 | "typeRoots": [
25 | "./node_modules/@types",
26 | "./node_modules"
27 | ],
28 | "types": [
29 | ]
30 | },
31 | "exclude": [
32 | "demo",
33 | "node_modules"
34 | ],
35 | "compileOnSave": false
36 | }
--------------------------------------------------------------------------------