Clean Script Include Framework#1939
Clean Script Include Framework#19391shabby wants to merge 1 commit intoServiceNowDevProgram:mainfrom
Conversation
This is a script include framework that I utilize in my day to day work to help reduce the number of extraneous logs that live on our instances as well as keep the code clean and readable so that new developers on the projects can quickly understand the purpose of the methods and how to utilize them. I've added some mock methods to the script include in code.js and at the bottom of the file I added an example of what it looks like calling the script include from a server script.
WillemZeiler
left a comment
There was a problem hiding this comment.
Thank you for your submission. Enjoyed going through it, especially the last function haha! However, the name of the script is not reflecting the content, perhaps change it for a more descriptive name. I have added some comments to the code, please see if you can make the requested changes. Closing this PR for now.
| @@ -0,0 +1 @@ | |||
| This is a generally useful framework for script includes that in use in my day to day work as well as personal projects on my PDI. It allows you to easily enable logs when calling whichever method you want to use when developing and debugging, then easily disable them by no longer passing in the initilization debug true param or setting it to false in your call. It's very sleek and I highly recommend using it wherever you can to help keep a clean codebase. I also included some examples of how I docment each of my methods. I find it to be helpful when dealing with complex methods I haven't touched in awhile as well as making it easy for new developers to look at the code and hit the ground running quickly. No newline at end of file | |||
There was a problem hiding this comment.
In the readme I would also expect notes for each function. Can you add this per function?
|
|
||
| superFunction2: function(){ | ||
| for (var i = 1; i <= 100000; i++) { | ||
| this.log("superFunction2", "ILOVEEARL); |
There was a problem hiding this comment.
10.000 that is a lot of love for Earl!
Probably best to make it clear that this is not ment to use in production... it might surprise you what people copy paste from the internet.
|
|
||
| superFunction2: function(){ | ||
| for (var i = 1; i <= 100000; i++) { | ||
| this.log("superFunction2", "ILOVEEARL); |
There was a problem hiding this comment.
Log misses a " at the end (after ILOVEEARL)
| }, | ||
|
|
||
| /** | ||
| * Description: Takes in an input then gets all records where field is input and created by is "iloveearl" |
There was a problem hiding this comment.
Can you elaborate a bit more how this wrapper function is helpful? What does it solve?
|
|
||
| // Global Variables For Use In Script | ||
| this.CASETYPE1 = '[casetype 1 table]'; | ||
| this.CASETYPE2 = '[casetype 2 table]'; |
There was a problem hiding this comment.
This does not seem to be used in the script?
| } | ||
|
|
||
| // Global Variables For Use In Script | ||
| this.CASETYPE1 = '[casetype 1 table]'; |
There was a problem hiding this comment.
Can you explain what people need to set here and why?
PR Description:
This is a script include framework that I utilize in my day to day work to help reduce the number of extraneous logs that live on our instances as well as keep the code clean and readable so that new developers on the projects can quickly understand the purpose of the methods and how to utilize them. I've added some mock methods to the script include in code.js and at the bottom of the file I added an example of what it looks like calling the script include from a server script.
Pull Request Checklist
Overview
Code Quality
Repository Structure Compliance
Core ServiceNow APIs/Server-Side Components/Client-Side Components/Modern Development/Integration/Specialized Areas/Documentation
Restrictions