Skip to content

Commit

Permalink
Adjust console snippet for better stack trace on iOS
Browse files Browse the repository at this point in the history
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
  • Loading branch information
tbuschto committed May 22, 2019
1 parent a735bee commit d619b65
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion snippets/console.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ contentView.append(
<Button text='info' onSelect={() => console.info(input.text)}/>
<Button text='warn' onSelect={() => console.warn(input.text)}/>
<Button text='error' onSelect={() => console.error(input.text)}/>
<Button text='trace' onSelect={() => console.trace()}/>
<Button text='trace' onSelect={printTrace}/>
<TextView top={16} font='18px'/>
</Stack>
);
Expand All @@ -19,3 +19,8 @@ const output = $(TextView).only();
tabris.onLog(ev =>
output.text = ev.level + ': ' + ev.message
);

function printTrace() {
// This line should appear in the trace:
console.trace();
}

0 comments on commit d619b65

Please sign in to comment.