Skip to content

Commit d619b65

Browse files
committed
Adjust console snippet for better stack trace on iOS
Unfortunately iOS stack traces skip arrow functions, which is why the cleaned-up stack trace was empty in this snippet. (The trace function falls back to the original stack trace.) Add a intermediate named function to the function so we get a clean trace on iOS. Change-Id: I86db8a64cc4bb7bfa2c2587a701d251608ca91c5
1 parent a735bee commit d619b65

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

snippets/console.jsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ contentView.append(
88
<Button text='info' onSelect={() => console.info(input.text)}/>
99
<Button text='warn' onSelect={() => console.warn(input.text)}/>
1010
<Button text='error' onSelect={() => console.error(input.text)}/>
11-
<Button text='trace' onSelect={() => console.trace()}/>
11+
<Button text='trace' onSelect={printTrace}/>
1212
<TextView top={16} font='18px'/>
1313
</Stack>
1414
);
@@ -19,3 +19,8 @@ const output = $(TextView).only();
1919
tabris.onLog(ev =>
2020
output.text = ev.level + ': ' + ev.message
2121
);
22+
23+
function printTrace() {
24+
// This line should appear in the trace:
25+
console.trace();
26+
}

0 commit comments

Comments
 (0)