Автоудаление отладочных свойств и объектов
Как правило, в нашем коде есть отладочные вызовы.
Например:
console.info("created "+object)
Или даже такие:
my.ajax.debugSend(message)
Google Closure Compiler позволяет удалять такие вызовы из production-кода. Здесь вопрос даже не столько в размере кода и в быстродействии, как в удобстве. Как правило, никому не нужны вызовы console.debug на боевом сервере.
Для этого можно добавить флаги, устанавливающие несколько недокументированных внутренних опций.
- --strip_types
- Типы, которые будут удалены. Например, "--strip_types console" приведет к удалению всех вызовов вида "console.*":
console.log , console.debug и т.п.
- --strip_name_prefixes
- Удаляет все вызовы, которые начинаются с указанной строки. Например, "--strip_name_prefixes debug" приведет к удалению вызовов вида "debug*" для любых объектов.
В частности, удалятся console.debug(..) , my.debugMethod(..) .
- --strip_name_suffixes
- Аналогично
--strip_name_prefixes , но вызовы должны заканчиваться на строку.
- --strip_type_prefixes
- То же самое, что
--strip_types , но проверяет не точное совпадение названия типа, а его начало.
Например:
/** @constructor */
function Animal(name, speed) {
my.ajax.debugSend(name)
console.info("created animal "+name)
this.name = name
this.speed = speed
}
После запуска с флагами:
--strip_types console --strip_name_prefixes debug
Останется:
function Animal(a, b) {
this.name = a;
this.speed = b
}
Чтобы подключить эту опцию, необходимо добавить соответствующие флаги компилятору:
@FlagSpec(help = "Specify stripTypes. You can include multiple.")
private static final Flag<List<String>> FLAG_strip_types
= Flag.stringCollector();
@FlagSpec(help = "Specify stripTypePrefixes. You can include multiple.")
public static final Flag<List<String>> FLAG_strip_type_prefixes = Flag.stringCollector();
@FlagSpec(help = "Specify stripTypeSuffixes. You can include multiple.")
private static final Flag<List<String>> FLAG_strip_name_suffixes
= Flag.stringCollector();
@FlagSpec(help = "Specify stripNamePrefixes. You can include multiple.")
private static final Flag<List<String>> FLAG_strip_name_prefixes
= Flag.stringCollector();
Здесь использован тип флагов stringCollector . Он допускает многократное указание одного и того же флага и собирает значения в список:
--strip_types console --strip_types debug ... .
В опции компилятора добавим значения из флагов.
options.stripTypes = new HashSet<String>(FLAG_strip_types.get());
options.stripTypePrefixes = new HashSet<String>(FLAG_strip_type_prefixes.get());
options.stripNameSuffixes = new HashSet<String>(FLAG_strip_name_suffixes.get());
options.stripNamePrefixes = new HashSet<String>(FLAG_strip_name_prefixes.get());
Эти опции запускают встроенный проход компилятора, который удаляет символы, подпадающие под strip-флаги.
Готовый файл MyCompilerRunner.java с этими опциями вы можете увидеть в конце статьи Использование внутренних опций и собственные флаги.
|
Подскажите чем еще(какие инструменеты), кроме Google Closure Compiler, можно убрать отладочный код?
С Closure Compiler проблема, что он обновился и убраны флаги com.google.common.flags.Flag. Та и не все js разработчики знают java.
No doubt this is an excellent post I got a lot of knowledge after reading good luck. Theme of blog is excellent there is almost everything to read, Brilliant post. Local Lead Generation
Such calls should be removed from production code, according to dordle you. The issue here isn't so much about code size and performance as it is about convenience. On the production server, no one usually needs to use console.debug.
Свойства отладки и объекты отладки используются для отслеживания проблем в вашем drift hunters приложении. Они также называются отслеживаемыми свойствами и отслеживаемыми объектами, что означает, что их можно отследить до исходного кода. Это полезно для отладки проблем в самом приложении или даже в других приложениях.
When you launch your app, it automatically gets rid of any gartic phone debug properties and phrazle objects created during the build process.
Google Closure Compiler allows you to remove such calls from production code.
rent atv st george utah
The main goal of the Wordle Today game is to guess the hidden word in 6 tries. In each line, you need to enter any word from 4 to 11 letters to find out what letters are in the target word. Depending on which word you entered, the letters will be highlighted in three colors.
During coloring pages, There are numerous images available that are appropriate for every age, gender, or level of difficulty. If both you and your youngster are adept in coloring, you can select more challenging, advanced images to challenge your creativity!
The Cinema HD V2 app offers users the ability to watch movies, series, and TV shows for free. The app is available for both iOS and Android devices. The app has a movie section that includes new releases, popular movies, and top rated movies. The TV show section includes popular shows, new episodes, and top rated shows. The app also has a search feature so users can easily find what they're looking for. The Cinema HD V2 app is a must-have for anyone who loves to watch movies and TV shows.
Runner gamers can't miss color tunnel . You may enjoy adventures in colorful tunnels for a first-time playing impression. If you play this game often, the tunnel's color will vary with each round.
Whereas there are similarities between wordle and a number of other different video games, there are two key variations between the 2. The words have been modified to make them extra fascinating and difficult. The Pandemic pipeline image is used to characterize the output stream of every word. This game has extra difficult guidelines than easy empty cells that have to be crammed in.
Google Closure Compiler allows you to remove such calls from production code. Here the question is not even so much in the size of the code and in speed, as in convenience. best carpet cleaning company
Looking for a fun and addictive game that will keep you entertained for hours on end? Look no further than Cookie Run: Kingdom Codes! This captivating game has over 200 levels of delicious gameplay, making it the perfect choice for anyone looking for a challenge. What’s more, with new levels added regularly, you’ll never get bored!
In Cookie Run: Kingdom Codes, your goal is to help our little hero Cookies escape the evil ovens of the Wicked Witch. To do this, you’ll need to use your quick reflexes and problem-solving skills to crack codes and unlock exit gates. With physics-based gameplay, every level is different and you’ll never know what to expect!
So what are you waiting for? Give Cookie Run: Kingdom Codes a try today and see if you can become the ultimate code-cracking champion!
Romskostenlos is a website where you can download ROMS games for free. Whether you're looking for classic games or the latest releases, we have them all! Our extensive collection includes all the popular titles, as well as some hidden gems that you'll love discovering.
We pride ourselves on providing a safe and easy-to-use website, so you can focus on enjoying your games. With just a few clicks, you'll be able to start playing the classics or try out the newest releases. And because we're always updating our selection, there's always something new to explore.
So why wait? Start your gaming journey today with https://romskostenlos.de/!
I've read a number of other blogs, but yours has convinced me; I hope you'll continue to provide more wonderful blogs in the future. run 3 online
Thank you for your post. I have read through several similar topics! However, your article gave me a very special impression, unlike other articles. I hope you continue to have valuable articles like this or more to share with everyone! nytimes crossword
This is a fantastic article. This is, in my opinion, one of the most well-written pieces ever. Your work is outstanding and inspirational. Thank you once again.
hurdle
This is a fantastic article. This is, in my opinion, one of the most well-written pieces ever. Your work is outstanding and inspirational. Thank you once again.
hurdle
It in fact was a amusement account it. Look advanced to far added agreeable from you! By the way, how can we communicate? 먹튀검증
Как правило, drywall tapingникому не нужны вызовы console.
Helpful post and great sharing. I am glad to discover this post Very valuable for me, as it contains part of data drive mad.
Whether you're in the mood for cooking up some mouth-watering burgers and fries, crafting the perfect pizza, or serving up some delectable desserts, Papa's Games has got you covered. With a variety of different game modes to choose from, including time management and strategy elements, these games are sure to keep you entertained for hours on end.
Siete alla ricerca di attività divertenti e gratuite per i vostri bambini che non coinvolgano gli schermi? Disegnidacolorarewk.com è perfetto per offrire ai vostri bambini uno sbocco divertente per essere creativi e accendere la loro immaginazione in modo educativo e piacevole! Con migliaia di pagine da colorare, dagli animali ai supereroi, ce n'è per tutti i gusti. Inoltre, è completamente gratuito!
Su Disegnidacolorarewk.com, la nostra priorità è assicurarci che i vostri bambini abbiano la migliore esperienza di colorazione. Poiché le nostre pagine sono gratuite, possono esprimere la loro creatività senza preoccuparsi di sprecare denaro per gli extra. Ogni pagina è completa di effetti speciali, colori vivaci e sfumature che rendono il disegno ancora più divertente! La parte migliore? Aggiungiamo sempre nuovi disegni alla collezione, così non ci sono mai le stesse pagine.
Quindi liberatevi di pastelli e penne e iniziate a colorare con Disegnidacolorarewk.com. Le nostre pagine sono sicure di tenere i vostri bambini impegnati e deliziati per ore! Iniziate a scoprire le possibilità divertenti ed educative oggi stesso: è tutto gratuito e accessibile online. Siate creativi e iniziate a colorare ora!
I've read a number of other blogs, but yours has convinced me. You may also be interested in an online movie and TV viewing application Dixmax Apk.
Your code is exceptionally clean and well-structured, fnf making it easy to understand and maintain.
This is a good and quality article that I just read. Thank you very much for sharing the article.
papa's freezeria
Experience the exhilarating rush of Slope game as you defy gravity and conquer challenges, immersing yourself in dynamic gameplay, minimalist design, and heart-pounding excitement that caters to gamers of all levels.
This is a good and quality article that I just read. Thank you very much for sharing the article APKMia.Com
There are many different types of residential roofing systems, just search for roofing contractor near me, Each with their own benefits and considerations. Materials include metal, tile, wood, and asphalt shingles.
Papa's Scooperia is a fun and exciting ice cream restaurant management game that offers the experience of running a family ice cream business.
Challenge yourself with tunnel rush unblocked world, a fast-paced tunnel racing game with no barriers or restrictions, perfect for quick, adrenaline-fueled sessions.
Отправить комментарий
Приветствуются комментарии:Для остальных вопросов и обсуждений есть форум.