IT |
ITmedia 総合記事一覧 |
[ITmedia PC USER] 直感的に使えるiPad専用タッチペン「A8 Duo」 |
https://www.itmedia.co.jp/pcuser/articles/2305/02/news104.html
|
itmediapcuser |
2023-05-02 13:22:00 |
Ruby |
Rubyタグが付けられた新着投稿 - Qiita |
RubyでAtCoder ABC270(A, B, C)を解いてみた |
https://qiita.com/shoya15/items/3247ac9d68c1a2fe7f90
|
atcoder |
2023-05-02 13:45:01 |
Ruby |
Rubyタグが付けられた新着投稿 - Qiita |
クラス設計 SingleResponsibility 〜トレードオフを考えよう〜 |
https://qiita.com/F_Yoko/items/347101166fb81d301c45
|
singleresponsibility |
2023-05-02 13:36:10 |
AWS |
AWSタグが付けられた新着投稿 - Qiita |
DataFrameとDynamicFrameの違いはわかりますか? |
https://qiita.com/kimuni-i/items/81a5b19f7750d4e06b73
|
awsgl |
2023-05-02 13:28:47 |
Docker |
dockerタグが付けられた新着投稿 - Qiita |
【Elasticsearch】DockerでElasticsearchを使えるようにする |
https://qiita.com/dai_chi/items/90497e17b387626be466
|
docker |
2023-05-02 13:00:50 |
技術ブログ |
Developers.IO |
RDS DB 엔진 버전 변경 도중 Current Parameter Group is non-default. You need to explicitly specify a new Parameter Group in this case (default or custom) 에러 해결 |
https://dev.classmethod.jp/articles/jw-resolving-errors-during-rds-db-engine-version-changes/
|
RDS DB 엔진버전변경도중Current Parameter Group is non default You need to explicitly specify a new Parameter Group in this case default or custom 에러해결안녕하세요클래스메소드김재욱 Kim Jaewook 입니다 이번에는RDS DB 엔진버전변경도중Current Parameter Group is non default You need to |
2023-05-02 04:43:03 |
海外TECH |
DEV Community |
Optimize your Angular app's user experience with preloading strategies |
https://dev.to/this-is-angular/optimize-your-angular-apps-user-experience-with-preloading-strategies-3ie7
|
Optimize your Angular app x s user experience with preloading strategiesPerformance optimization is a critical aspect of creating a successful Angular app Slow loading times can lead to a frustrating user experience and ultimately drive users away One common technique to improve performance is lazy loading which allows the app to be broken down into smaller chunks that can be loaded on demand However another important concept that is often overlooked is preloading strategies In this first article of the series Load Less Do More A Guide to Angular Preloading Strategies we will explore the world of preloading strategies and how they can be used to speed up the loading process and provide a smoother user experience We will discuss what preloading strategies are how they work and the benefits they offer To help illustrate these concepts we will walk through an example of how to create a custom preloading strategy By the end of this article you will have a solid understanding of preloading strategies and how they can be applied to your Angular app Table of ContentsWhy performance optimization is importantWhy do preloading strategies matter Default preloading strategies in AngularUsing preloading strategiesImplementing our own preloading strategyTakeaways Why performance optimization is importantWhen creating web pages or online tools performance optimization is a crucial aspect to provide a decent user experience often referred to as UX Do you remember the last time you were waiting for a web page to load No matter what the site might have been I doubt that you are remembering it as a pleasant experience In general nobody likes to use a slow website as it can lead to frustration or even fear from the users browsing it Will it correctly saves my progress Can I trust this website with my personal information Ensuring that a website runs smoothly and loads quickly leads to a better UX overall Moreover the speed of the app can impact how users perceive your brand a slow and unresponsive site can create a negative impression making users less likely to return Why do preloading strategies matter One of the first thing you fill hear about when seeking to improve the performances of your Angular app is lazy loading By splitting your application modules features into smaller chunks you can load them on the fly instead of bundling them all together and force the user to download the whole website when accessing any page However sometimes you might know that from a business perspective a user will use some lazy modules when accessing a page In that case preloading them might make sense to avoid an unnecessary latency to the user that will eventually want to see the page For those specific cases Angular introduced the concept of preloading strategies A preloading strategy is a way to tell the Angular s router to load modules in the background so that when the user navigates to a new page the required modules have already been loaded and the page appears almost instantaneously A preloading strategy is a simple Angular class that extends the PreloadingStrategy abstract class defined as such abstract class PreloadingStrategy abstract preload route Route fn gt Observable lt any gt Observable lt any gt When executed this methods will return the call to fn if the route should be preloaded or an Observable lt null gt if not Default preloading strategies in Angular NoPreloadingBy default when using lazy loading all modules are lazily loaded This is achieve by enabling the NoPreloading Strategy by default which is described as Provides a preloading strategy that does not preload any modules Its usage will result in the loading of the targeted module only when requested Unfortunately this can results in slower subsequent loading time as the user navigates through the app PreloadAllModulesIt s opposite also exists as the PreloadAllModules Strategy which will as its name suggests it preload everything Provides a preloading strategy that preloads all modules as quickly as possible Unlike the previous strategy this time everything is loaded at once However neither of those strategy might prove optimal if you want finer control on the way you load your Angular app For those cases it is possible to create and use your own preloading strategy Using Preloading StrategiesIn order to indicate which preloading strategy the router should apply you need to provide it to the preloadingStrategy property of the RouterModule forRoot method in your app s root module NgModule imports RouterModule forRoot routes preloadingStrategy export class AppModule However if you are now using Standalone Components you might want to use a provider to call during the bootstrap of your application This can be done by adding withPreloading to the setup done in provideRouter bootstrapApplication AppComponent providers provideRouter routes withPreloading Note that if you write your own implementation of a preloading strategy you will have to provide it on the root level too so that it can be retrieved from the dependency injection container Implementing our own preloading strategyWe mentioned the importance of creating a custom preloading strategy sometime let s see how to do it PurposeOur custom preloading strategy will simply preload any lazy loaded route that has the flag preload set to true in its route data SetupI will slightly modify the routes that I defined in the previous GIFs to add the flag export const routes Route path feature loadComponent gt import app feature feature component then m gt m FeatureComponent This route should be preloaded data preload true path feature loadChildren gt import app feature feature route then m gt m routes With our custom PreloadingStrategy we should see that the Feature is loaded from the start but Feature is not Show me the code A preloading strategy is nothing more than a service that extends PreloadingStrategy Knowing this let s create our FlagBasedPreloadingStrategy service flag based preloading strategy tsimport Injectable from angular core import PreloadingStrategy Route from angular router import Observable from rxjs Injectable providedIn root export class FlagBasedPreloadingStrategy extends PreloadingStrategy For clarity I prefer load rather than fn for the callback name preload route Route load gt Observable lt any gt Observable lt any gt return route data preload true load of null Notice how we provided it in root so that we can indicate the router to use it on bootstrapThe logic doesn t matter much here We simply check the current route for the flag and if present we will load the module and otherwise we will not Looking great We still have to indicate the router to use it tho This can be done in the same way as the built in ones by providing it during the bootstrap phase bootstrapApplication AppComponent providers provideRouter routes withPreloading FlagBasedPreloadingStrategy Now if we open the network tab in the devtools we should see that the feature is loaded but feature is not Similarly if we now flag the feature instead of the feature we should see it loaded instead of the other to add the flag export const routes Route path feature loadComponent gt import app feature feature component then m gt m FeatureComponent data preload true path feature loadChildren gt import app feature feature route then m gt m routes data preload true Working as expected TakeawaysIn this article we saw what preloading strategies are and how they can help you to optimize the loading of your application to offer a smoother user experience by loading the required modules in the background so the user doesn t have to wait for them to load when navigating to a new page By default Angular provides two strategies A NoPreloading Strategy that does not load any lazy routeA PreloadAllModules Strategy that does the oppositeHowever in some business cases you might want to orchestrate the loading of your lazy modules in a specific way For such situations implementing a custom preloading strategy might be the solutionIf you would like to check the resulting code you can head on to the associated pBouillon DEV PreloadingStrategies Demo code for the Optimize your Angular app s user experience with preloading strategies article Optimize your Angular app s user experience with preloading strategiesDemo code for the Optimize your Angular app s user experience with preloading strategies article on DEV View on GitHubIn a future article on this series we will see how to articulate guards and preloading strategies stay tuned I hope that you learnt something useful there Pierre BouillonFollow Software Engineer Privacy Advocate Coffee Lover Photo by Joey Kyber on Unsplash |
2023-05-02 04:21:11 |
海外TECH |
CodeProject Latest Articles |
A Rational .NET Class |
https://www.codeproject.com/Tips/5359855/A-Rational-NET-Class
|
functionality |
2023-05-02 04:43:00 |
海外TECH |
CodeProject Latest Articles |
Introduction to glTF |
https://www.codeproject.com/Articles/5360022/Introduction-to-glTF
|
files |
2023-05-02 04:30:00 |
海外ニュース |
Japan Times latest articles |
China’s exit bans multiply as political control tightens under Xi |
https://www.japantimes.co.jp/news/2023/05/02/asia-pacific/china-exit-ban-tightens/
|
China s exit bans multiply as political control tightens under XiScores of Chinese and foreign nationals have been ensnared by exit bans according to a new report by the rights group Safeguard Defenders |
2023-05-02 13:43:14 |
海外ニュース |
Japan Times latest articles |
Scientists use brain scans and AI to ‘decode’ thoughts |
https://www.japantimes.co.jp/news/2023/05/02/world/science-health-world/ai-thought-decoder/
|
mental |
2023-05-02 13:29:52 |
ニュース |
BBC News - Home |
The Papers: 'NHS leaders despair' and 'civil service crisis' |
https://www.bbc.co.uk/news/blogs-the-papers-65452594?at_medium=RSS&at_campaign=KARANGA
|
resign |
2023-05-02 04:51:01 |
ニュース |
BBC News - Home |
Met Gala 2023: Doja Cat and Jared Leto deliver wildest looks |
https://www.bbc.co.uk/news/entertainment-arts-65413976?at_medium=RSS&at_campaign=KARANGA
|
famous |
2023-05-02 04:28:40 |
ビジネス |
不景気.com |
SMBC日興証券の23年3月期は398億円の赤字、相場操縦影響 - 不景気com |
https://www.fukeiki.com/2023/05/smbc-nikko-2023-loss.html
|
三井住友フィナンシャルグループ |
2023-05-02 04:02:23 |
ニュース |
Newsweek |
後ろ足がない... 2本足で歩くキツネに全イギリス人が驚愕 |
https://www.newsweekjapan.jp/stories/world/2023/05/2-484.php
|
後ろ足がない本足で歩くキツネに全イギリス人が驚愕この目で見なければ信じられないー本足のキツネなんて。 |
2023-05-02 13:25:00 |
IT |
週刊アスキー |
サンワサプライ、静音スイッチを採用したワイヤレスエルゴノミクスマウスを発売 |
https://weekly.ascii.jp/elem/000/004/135/4135392/
|
maewbsbk |
2023-05-02 13:30:00 |
海外TECH |
reddit |
[Post Game Thread] The Denver Nuggets (2-0) defeat the Phoenix Suns (0-2), 97-87. Nikola Jokic scores 39 PTS. |
https://www.reddit.com/r/nba/comments/135b1r8/post_game_thread_the_denver_nuggets_20_defeat_the/
|
Post Game Thread The Denver Nuggets defeat the Phoenix Suns Nikola Jokic scores PTS Box Scores NBA Yahoo nbsp GAME SUMMARY Location Ball Arena Clock Final Officials Eric Lewis Sean Wright and John Goble Team Q Q Q Q Total Phoenix Suns Denver Nuggets nbsp TEAM STATS Team PTS FG FG P P FT FT OREB TREB AST PF STL TO BLK Phoenix Suns Denver Nuggets nbsp PLAYER STATS Phoenix Suns MIN PTS FGM A PM A FTM A ORB DRB REB AST STL BLK TO PF ± Josh OkogieSF Kevin DurantPF Deandre AytonC Devin BookerSG Chris PaulPG Bismack Biyombo Torrey Craig Cameron Payne Damion Lee Ish Wainright Jock Landale Darius Bazley Terrence Ross Landry Shamet T J Warren Denver Nuggets MIN PTS FGM A PM A FTM A ORB DRB REB AST STL BLK TO PF ± Michael Porter Jr SF Aaron GordonPF Nikola JokicC Kentavious Caldwell PopeSG Jamal MurrayPG Christian Braun Bruce Brown Jeff Green Thomas Bryant Vlatko Cancar Reggie Jackson DeAndre Jordan Zeke Nnaji Ish Smith Peyton Watson rnbapgtgenerator by u fukr submitted by u IamOlderthanMe to r nba link comments |
2023-05-02 04:21:54 |
コメント
コメントを投稿