Skip to content

Commit a5c530b

Browse files
author
farfromrefug
committed
chore: demo
1 parent 4b04ffa commit a5c530b

File tree

2 files changed

+38
-3
lines changed

2 files changed

+38
-3
lines changed

demo-vue/app/main.ts

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as Sentry from '@nativescript-community/sentry';
22
import * as Tracing from '@nativescript-community/sentry/tracing';
3-
import { Application, Trace, Utils } from '@nativescript/core';
3+
import { Application, NavigatedData, Page, Trace, Utils, View } from '@nativescript/core';
44
import { on as applicationOn, launchEvent } from '@nativescript/core/application';
55
import Vue from 'nativescript-vue';
66
import Home from './views/Home';
@@ -36,6 +36,42 @@ async function startSentry() {
3636
enableUserInteractionTracing: false,
3737
enableAutoBreadcrumbTracking: false,
3838
});
39+
Page.on('navigatingTo', (event: NavigatedData) => {
40+
Sentry.addBreadcrumb({
41+
category: 'navigation',
42+
type: 'navigation',
43+
// We assume that context.name is the name of the route.
44+
message: `Navigation to ${event.object}`,
45+
data: {
46+
isBackNavigation: event.isBackNavigation,
47+
from: `${(event.object as Page).frame?.currentPage}`,
48+
to: `${event.object}`
49+
}
50+
});
51+
});
52+
View.on('showingModally', (event: NavigatedData) => {
53+
Sentry.addBreadcrumb({
54+
category: 'navigation',
55+
type: 'navigation',
56+
// We assume that context.name is the name of the route.
57+
message: `Navigation to Modal ${event.object}`,
58+
data: {
59+
from: `${(event.object as View)._modalParent}`,
60+
to: `${event.object}`
61+
}
62+
});
63+
});
64+
View.on('closingModally', (event: NavigatedData) => {
65+
Sentry.addBreadcrumb({
66+
category: 'navigation',
67+
type: 'navigation',
68+
// We assume that context.name is the name of the route.
69+
message: `Closing modal ${event.object}`,
70+
data: {
71+
from: `${event.object as View}`
72+
}
73+
});
74+
});
3975
setTimeout(()=>{
4076
Sentry.withScope(scope => {
4177
try {

demo-vue/app/views/Home.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,7 @@ export default {
110110
// console.error('error', error);
111111
// console.error('keys', Object.keys(error));
112112
// console.error('nativeExceptio', error.nativeException);
113-
console.error('stackTrace', error.stackTrace);
114-
console.error('stack', error.stack);
113+
// console.error('stackTrace', error.stackTrace);
115114
// console.error('stack', error.stack);
116115
// console.error('stacktrace', error.stacktrace);
117116
Sentry.captureException(error);

0 commit comments

Comments
 (0)