-
Notifications
You must be signed in to change notification settings - Fork 58
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
Ability to add custom debug-block #85
Comments
There might even be situations where you want some code only when not debugging and left away during debug. So, what about /#IF_DEBUG/ Marco |
a simple usage of a debugblock would be when creating Promises. In this examples you need to clean more code than just Y.log().
|
For this cases I do as I've seen done in the YUI code: use emtpy Y.log() on the line to be removed by non debug versions. It means that: mybutton.on('click', function() { /*#IF_DEBUG*/ if (promiseBtnclickOnTime.getStatus==='pending') { Y.log('button clicked on time'); } /*#END_DEBUG*/ // resolve() can be called even if the promise is rejected --> a promise cannot change it state resolve(); }); becomes mybutton.on('click', function() { if (promiseBtnclickOnTime.getStatus==='pending') { Y.log();//for debug Y.log('button clicked on time'); } Y.log();//for debug // resolve() can be called even if the promise is rejected --> a promise cannot change it state resolve(); }); Not as clean but it gets the job done |
It would be great add a feature by which we can add a custom debug-block which are removed from non-debug builds.
Inline code like /#DEBUG/ debug code goes here /#END_DEBUG/
It could be solved by adding a debug block regex by default for everyone, or by adding a way to configure a custom regex per module.
The text was updated successfully, but these errors were encountered: