Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug: make a function helper with stack trace #333

Open
qfox opened this issue Aug 16, 2016 · 3 comments
Open

Debug: make a function helper with stack trace #333

qfox opened this issue Aug 16, 2016 · 3 comments

Comments

@qfox
Copy link
Member

qfox commented Aug 16, 2016

Something like: new Error().stack for usual JS but for bem-xjst templates.

Stack should contains only user templates and external calls and skip internal bem-xjst code.
Helper should be possible to call from any user template.

Something like:

bemhtml.compile(function(){
  block('b').def()(function(){ console.log(this.trace()); });
});
bemhtml.apply({block: 'b'});
// Trace
//     at b.def:1:13 (b.bemhtml.js:1:42)
//     at repl:4:1

cc @a-x-

@miripiruni
Copy link
Contributor

@zxqfox BTW you can not use this.trace() with () => console.log(this.trace()) as template body. You need use regular function, not arrow function.

;)

@qfox
Copy link
Member Author

qfox commented Aug 19, 2016

@miripiruni fixed, ty.

@miripiruni
Copy link
Contributor

The question is: «show me trace route how templates work».

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants