{"id":922,"date":"2019-05-15T16:44:09","date_gmt":"2019-05-15T16:44:09","guid":{"rendered":"http:\/\/fluentreports.com\/blog\/?p=922"},"modified":"2019-05-24T07:25:36","modified_gmt":"2019-05-24T07:25:36","slug":"nativescript-5-40-released","status":"publish","type":"post","link":"http:\/\/fluentreports.com\/blog\/?p=922","title":{"rendered":"NativeScript 5.40 Released"},"content":{"rendered":"\n<div class=\"wp-block-image\"><figure class=\"alignright\"><img loading=\"lazy\" decoding=\"async\" width=\"395\" height=\"394\" src=\"http:\/\/fluentreports.com\/blog\/wp-content\/uploads\/2019\/05\/ns-540.png\" alt=\"\" class=\"wp-image-923\" srcset=\"http:\/\/fluentreports.com\/blog\/wp-content\/uploads\/2019\/05\/ns-540.png 395w, http:\/\/fluentreports.com\/blog\/wp-content\/uploads\/2019\/05\/ns-540-150x150.png 150w, http:\/\/fluentreports.com\/blog\/wp-content\/uploads\/2019\/05\/ns-540-300x300.png 300w\" sizes=\"auto, (max-width: 395px) 100vw, 395px\" \/><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">NativeScript 5.40 only offers a smaller number of fixes and features than usual; but is still well worth upgrading to.     It will probably be the last major 5.x release.   NativeScript 6.00 is on the horizon...<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The most interesting update (for me) is actually the Android V8 engine has been upgraded yet again.   Android engine is now on v8 v 7.4 - which offers even faster JavaScript parsing (in some cases up to 10% faster)   In addition to the engine speed ups; v8 now has better memory management and much better deadcode elimination.  <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">So just upgrading the runtimes to 5.4 should again give you a faster android app...  So it is worth it just for this alone.   Nothing changed on the iOS side here...<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In addition the v8 v7.4 now offers support for Private class variables; an ESNext feature that is finally shipping in v8.     If you are unfamiliar with this feature, this feature is needed for keeping private variables private.  \ud83d\ude00<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">class CoolClass {\n&nbsp;&nbsp;iAmPublic = 1;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/ .iAmPublic is public variable\n&nbsp;&nbsp;#iAmPrivate = 2;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/ .#iAmPrivate is private variable\n\n&nbsp;&nbsp;getIAmPrivate() {\n&nbsp;&nbsp;&nbsp;&nbsp; ++this.#iAmPrivate;\n&nbsp;&nbsp;}\n}\n\nconst m = new CoolClass();\nconsole.log(&quot;I am private now equals:&quot;, m.getIAmPrivate()); \/\/ runs OK\nm.#iAmPrivate = 0;&nbsp;&nbsp;\/\/ TOTALLY FAILS!&nbsp;&nbsp; <\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Unfortunately, JavaScriptCore does NOT support this feature yet and the code will fail to even parse on JSC, so don't use it in any shared code.     This is an Android only feature.   TypeScript will soon be adding this feature, so this should become a common way of making class fields private...<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Important Depreciation Notice<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">In version 5.2 short imports have been depreciated; I do not know when they will no longer actually work; but basically things like  require(\"http\")  are no long valid; you need to do require(\"tns-core-modules\/http\").  The primary reason for this is that webpacking requires the full path; and it has problems with short imports.    Please note this now becomes more critical that you handle this; NativeScript 6.00 will be 100% webpack only; meaning that if you don't fix your code it might fail to build until you do so in NativeScript 6.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Core Modules <\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The core modules offers the following enhancements and fixes...<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Multiple iOS components have crashing issues fixed<br>FormattedText crashing issue fixed<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Android<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Upgrade to V8 7.4.288 - which offers <br>- Private Class Fields<br>- Faster JS Parsing<br>- Better Dead Code Elimination<br>Static Binding Generator fixes and enhancements<br>Gradle 3.40 support.<br>Several memory leaks fixed<br>v8 Symbols exportable (for native v8 extensions)<br>Elevation Shadow Support<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">iOS<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Allows compiling Swift code as part of app_resources<br>Minor leak fixed <br>Unicode crash fix<br>Some Metadata generation fixes<br><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">CLI<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">HMR is now the default app type<br><code>TNS Create Plugin <\/code> fixes<br>Better handling of CTRL-C <br>CocoaPod handling improved<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><br><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Updating NativeScript<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">To get updated; you first need to do:<br><strong>npm i -g nativescript@latest<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">That will get you the latest version of NativeScript CLI; once you have it; do a \"tns --version\" and verify it prints out \"5.4.x\".&nbsp; Then do a \"<strong>tns doctor<\/strong>\" to verify your environment is up to date and has all the newest support tools you need for a successful build.&nbsp;&nbsp; <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To update a project; you need to do the following:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Latest Runtimes:<br><strong>tns platform remove android &amp;&amp; tns platform add android@latest<\/strong><br><strong>tns platform remove ios &amp;&amp; tns platform add ios@latest<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Latest Core modules:<br><strong>npm r tns-core-modules --save<\/strong><br><strong>npm i tns-core-modules@latest --save<\/strong><br><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To install Webpack &amp; HMR support:<br><strong>npm i nativescript-dev-webpack@latest --save-dev<\/strong><br>Note: you need to have nativescript-dev-webpack as a development dependency for HMR to work.&nbsp;&nbsp; <br><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To install latest NativeScript Angular plugin<br><strong>npm i nativescript-angular@latest --save<\/strong><br>You will then need to install the actual angular bits; which as of this post v6 is currently supported.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The addition of all the additional analytics\/tracking to the CLI reminded me; you can disable it permanently; if you value your privacy by doing:<br><strong>tns usage-reporting disable &amp;&amp; tns error-reporting disable<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Known issues<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>HMR has some issues especially with pure Javascript NativeScript-Core applications.  See <a href=\"http:\/\/fluentreports.com\/blog\/?p=935\">http:\/\/fluentreports.com\/blog\/?p=935<\/a> for information and how to switch back to Legacy mode.<\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>NativeScript 5.40 only offers a smaller number of fixes and features than usual; but is still well worth upgrading to. It will probably be the last major 5.x release. NativeScript 6.00 is on the horizon... The most interesting update (for me) is actually the Android V8 engine has been upgraded yet again. Android engine is&hellip; <a class=\"more-link\" href=\"http:\/\/fluentreports.com\/blog\/?p=922\">Continue reading <span class=\"screen-reader-text\">NativeScript 5.40 Released<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-922","post","type-post","status-publish","format-standard","hentry","category-uncategorized","entry"],"_links":{"self":[{"href":"http:\/\/fluentreports.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/922","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/fluentreports.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/fluentreports.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/fluentreports.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/fluentreports.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=922"}],"version-history":[{"count":2,"href":"http:\/\/fluentreports.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/922\/revisions"}],"predecessor-version":[{"id":940,"href":"http:\/\/fluentreports.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/922\/revisions\/940"}],"wp:attachment":[{"href":"http:\/\/fluentreports.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=922"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/fluentreports.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=922"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/fluentreports.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=922"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}