IT |
気になる、記になる… |
「Kindle Paperwhite」に新色のデニムブルーとライトグリーンが登場 |
https://taisy0.com/2023/02/02/168012.html
|
amazon |
2023-02-02 11:58:34 |
IT |
ITmedia 総合記事一覧 |
[ITmedia News] ソニーG社長交代は“交代というより強化” 吉田・十時2トップ体制の狙い |
https://www.itmedia.co.jp/news/articles/2302/02/news211.html
|
経営体制 |
2023-02-02 20:30:00 |
IT |
ITmedia 総合記事一覧 |
[ITmedia News] 偽物の「浄水カートリッジ」が流通 Amazonや楽天でも 消費者庁が注意喚起 |
https://www.itmedia.co.jp/news/articles/2302/02/news212.html
|
amazon |
2023-02-02 20:25:00 |
IT |
ITmedia 総合記事一覧 |
[ITmedia News] Twitter API有料化、アカウント認証には影響なし? 「ブルアカ」「アズレン」のYostarが「Twitter社に確認」 |
https://www.itmedia.co.jp/news/articles/2302/02/news210.html
|
itmedianewstwitterapi |
2023-02-02 20:21:00 |
IT |
ITmedia 総合記事一覧 |
[ITmedia ビジネスオンライン] ディズニーリゾート、「平日・首都圏在住者ら限定」で割安なパスポート新設 4月6日から |
https://www.itmedia.co.jp/business/articles/2302/02/news205.html
|
itmedia |
2023-02-02 20:05:00 |
海外TECH |
MakeUseOf |
Massive T-Mobile Data Breach, Smartphone RAM Explained, and Parental Controls for Phones and Tablets |
https://www.makeuseof.com/t-mobile-data-breach-smartphone-ram-parental-controls/
|
Massive T Mobile Data Breach Smartphone RAM Explained and Parental Controls for Phones and TabletsOur tech podcast for technophobes tackles parental control software and whether your phone has enough RAM |
2023-02-02 11:30:15 |
海外TECH |
MakeUseOf |
The Global Chip Shortage Has Affected Cars: When Will It End? |
https://www.makeuseof.com/global-chip-shortage-affected-cars/
|
production |
2023-02-02 11:16:15 |
海外TECH |
MakeUseOf |
Samsung Galaxy S23 vs. S23+ vs. S23 Ultra: Which Should You Choose? |
https://www.makeuseof.com/samsung-galaxy-s23-vs-s23-plus-vs-s23-ultra-comparison/
|
variant |
2023-02-02 11:05:43 |
海外TECH |
DEV Community |
Stop being scared of InjectionTokens |
https://dev.to/this-is-angular/stop-being-scared-of-injectiontokens-2406
|
Stop being scared of InjectionTokensInjection Tokens seem to intimidate many developers They don t understand what they are how to use them and their purpose To overcome the fear of this feature it is important to have a basic understanding of how Angular s Dependency Injection works A separate article will dive deeper into the inner workings of Angular s DI system for a full understanding Here s an example of how the singleton pattern operates When we add Injectable providedIn root to one of our services Injectable providedIn root export class MyService The first time we will call MyService Angular will store the service in a record of the RootInjector with the key being class MyService and the value being an object containing a factory of MyService the current value and a multi flag record index key class MyService value factory f MyService Factory t multi undefined value This way the next time we want to inject our service through the constructor or the inject function in another Component Angular s DI will look for the service in the record object and return its current value or create it using the factory function It s also crucial to understand what happens when we provide our service directly in the bootstrapApplication or Component provider array To inject MyService we write the following Component providers MyService export class AppComponent This code is a shorthand syntax for Component providers provide MyService useClass MyService export class AppComponent By creating an InjectionToken we are creating a static key for our record or dictionary of services By writing this export const DATA new InjectionToken lt string gt data We are creating a constant of type string The InjectionToken can take an object as second parameter containing a factory function and a providedIn attribut Although this parameter will be deprecated as the default value is root and there is no other possibility The factory function acts like a default value if no other value is provided Let s take a look at the following example to clarify it export const DATA new InjectionToken lt string gt data factory gt toto Angular will store our token inside the record object of the RootInjector record index key InjectionToken desc data ngMetadataName InjectionToken value factory gt toto multi undefined value toto Then when we inject it inside a Component Angular s DI will look for DATA key in the RootInjector s record and inject the corresponding value toto is this example Component template data toto export class AppComponent data inject DATA However in a Component provider array we can override this Token to map DATA with another value This time Angular will store the value inside the record of the NodeInjector Component provider provide DATA useValue titi template data titi export class AppComponent data inject DATA When Angular searches for the DATA token it first examines the component s NodeInjector then the NodeInjector of its parent and finally the RootInjector As a result in this example the output value will be titi Providing your InjectionToken useValueThe useValue keyword allows us to supply a string number interface class instance or any constant value It is very useful for setting up configuration properties export type Environment local dev int prod export interface AppConfig version string apiUrl string environment Environment export const APP CONFIG new InjectionToken lt AppConfig gt app config export const getAppConfigProvider value AppConfig ValueProvider gt provide APP CONFIG useValue value bootstrapApplication AppComponent providers getAppConfigProvider environment environment files In the example above we are creating an InjectionToken to store our environment configuration This is the recommended method for accessing environment variables in an Nx workspace as it avoids circular dependencies To retrieve our environment properties we inject the token inside our component Component selector app root standalone true template config version export class AppComponent config inject APP CONFIG useClassThe useClass keyword allows us to instantiate a new class This is useful for implementing the dependency inversion principle for instance The dependency inversion principle is a software design principle that states that different layers depend on abstractions rather than on each other This inversion makes the code more flexible maintainable and more testable export interface Search lt T gt search search string gt T export const SEARCH new InjectionToken lt Search lt object gt gt search Component selector shareable standalone true imports ReactiveFormsModule NgFor AsyncPipe JsonPipe template lt input type text formControl searchInput gt lt button click search gt lt button gt lt div ngFor let d of data async gt d json lt div gt export class ShareableComponent searchService inject SEARCH optional true data new BehaviorSubject lt object gt searchInput new FormControl nonNullable true We are not injecting searchService with the constructor because inject function infers the type constructor if this searchService throw new Error SEARCH TOKEN must be PROVIDED search this data next this searchService search this searchInput value The ShareableComponent displays an input field a search button and a list of the search results When we hit the search button the component searches somewhere and displays the results This component is highly generic and does not require any additional information about how or where to search Implementation details are provided by the parent component Let s see how we can utilize the ShareableComponent First we will create an utility function to provide our Token This creates a better developer experience and reduces the likelihood of errors as it adds strong typing to our function export const getSearchServiceProvider lt T C extends Search lt T gt gt clazz new gt C ClassProvider gt provide SEARCH useClass clazz Using the above function we can supply the desire implementation of the Search interface within the component that calls the ShareableComponent When Angular attempts to inject the SEARCH InjectionToken it will traverse each NodeInjector up the component tree until it finds the provided implementation Injectable export class DetailSearchService implements Search lt Detail gt search search string Detail gt implementation of our search function Component selector parent standalone true imports ShareableComponent providers getSearchServiceProvider DetailSearchService template lt shareable gt lt shareable gt export class ParentComponent If we want to reuse ShareableComponent with a different implementation of search this becomes very easy useFactoryThe useFactory keyword allows us to provide an object though a factory function export const USER new InjectionToken lt string gt user export const getUserProvider index number FactoryProvider gt provide USER useFactory gt inject Store select selectUser index The inject function enables us to incorporate other services within the factory function Alternatively if you do not wish to use the inject function the FactoryProvider has a third parameter named deps where you can inject other injectable services export const getUserProvider index number FactoryProvider gt provide USER useFactory store Store gt store select selectUser index deps Store But I advice you to use the inject function It s cleaner and easier to understand We can then use this provider as follow to retrieve one user from the store Component selector app root standalone true providers getUserProvider template lt div gt user lt div gt export class ParentComponent user inject USER useExistingThe useExisting keyword allows us to map an existing instance of a service to a new token creating an alias When examining the record object created by Angular we have the following record index key InjectionToken desc data ngMetadataName InjectionToken ɵprov undefined value factory gt ɵɵinject resolveForwardRef provider useExisting multi undefined value Angular resolves the InjectionToken by forwarding the reference to the class specified in the useExisting parameter It searches the NodeInjector and RootInjector for the class so it must be set beforehand or an error will occur NullInjectorError No provider for XXX NotesWhen providing an InjectionToken through the providers there is not type safety For example the following code would not produce a Typescript error even though the type is inferred as number for num but a string is provided We might have an error at runtime export const NUMBER new InjectionToken number Component providers provide NUMBER useValue toto export class ParentComponent num inject NUMBER property ParentComponent num number To ensure type safety I advise to create a utility function to provide your token export const NUMBER new InjectionToken lt number gt number export const getNumberProvider num number ValueProvider gt provide NUMBER useValue num NUMBER token should be provided through this function Component providers getNumberProvider toto Argument of type string is not assignable to parameter of type number export class ParentComponent num inject NUMBER This way our implementation is safe and any errors will occur at compile time rather than at runtime That s it for this article You should now have a good understanding of InjectionToken and what they do mean I hope that this information has demystified them for you and you will no longer feel intimidated by them I hope you learned new Angular concept If you liked it you can find me on Twitter or Github If you want to accelerate your Angular and Nx learning journey come and check out Angular challenges |
2023-02-02 11:25:00 |
海外TECH |
Engadget |
PS5 beta update finally adds Discord voice chat |
https://www.engadget.com/ps5s-latest-beta-is-more-social-with-discord-voice-chat-and-more-111533459.html?src=rss
|
PS beta update finally adds Discord voice chatAfter lightly integrating Discord features on PlayStation consoles in early voice chat has finally arrived in its latest beta update Sony has announced PS Testers in the US Canada and Japan will be able to join Discord calls some months after Microsoft introduced the feature on Xbox The PS is also gaining Variable Refresh Rate support for p along with dashboard UX improvements and more nbsp Discord integration is a bit clunky much like it was on Xbox at first Here s how to set it up and use it according to Discord s blog First you need to link your PlayStation Network PSN account to Discord then select Discord under quot Linked Services quot After that you can complete the integration using either a QR code or the PS s integrated browser nbsp Each time you want to use Discord chat on console though you ll need to use your mobile device to transfer your conversation which isn t ideal Back in November Microsoft made it possible to join Discord chats directly from the console so hopefully Sony will eventually do the same nbsp SonyOther new social features include a new way to share screens party chats in the dashboard and quot friends who play quot that shows which of your friends are playing a game right now Sony also introduced Variable Refresh Rate support for p gaming so HDMI displays should exhibit smoother performance at that resolution with less tearing Sony launched PS VRR in April last year and p support shortly afterwards but the two features have yet to work together nbsp Gamers will also find new tools to access PS saved data on a PS along with the ability to move games from one PS console to another over WiFi or ethernet The new beta is rolling out to certified testers today and should be available to everyone else over the next few months |
2023-02-02 11:15:33 |
医療系 |
医療介護 CBnews |
千葉⼤病院発「ちば医経塾」塾生募集、28日まで-病院経営のスペシャリストを目指せ |
https://www.cbnews.jp/news/entry/20230202194402
|
財務 |
2023-02-02 20:30:00 |
医療系 |
医療介護 CBnews |
電子化すべき情報にEPDSなどアセスメント追加-厚労省が提案、保健指導に重要な情報 |
https://www.cbnews.jp/news/entry/20230202200046
|
保健指導 |
2023-02-02 20:20:00 |
ニュース |
BBC News - Home |
Shell reports highest profits in 115 years |
https://www.bbc.co.uk/news/uk-64489147?at_medium=RSS&at_campaign=KARANGA
|
record |
2023-02-02 11:03:36 |
ニュース |
BBC News - Home |
BBC News channel announces chief presenter line-up for revamp |
https://www.bbc.co.uk/news/entertainment-arts-64496388?at_medium=RSS&at_campaign=KARANGA
|
channels |
2023-02-02 11:32:39 |
ニュース |
BBC News - Home |
Beyoncé ticket rush begins as pre-sale opens for UK tour dates |
https://www.bbc.co.uk/news/entertainment-arts-64496382?at_medium=RSS&at_campaign=KARANGA
|
album |
2023-02-02 11:30:29 |
ニュース |
BBC News - Home |
Bring back duty-free perk to boost London - mayor |
https://www.bbc.co.uk/news/uk-england-london-64489317?at_medium=RSS&at_campaign=KARANGA
|
reinstate |
2023-02-02 11:13:00 |
ニュース |
BBC News - Home |
Mascara: What is the TikTok trend all about? |
https://www.bbc.co.uk/news/newsbeat-64465583?at_medium=RSS&at_campaign=KARANGA
|
mascara |
2023-02-02 11:06:05 |
ニュース |
BBC News - Home |
England in Bangladesh: Alex Hales sits out tour but Rehan Ahmed and Tom Abell picked |
https://www.bbc.co.uk/sport/cricket/64497302?at_medium=RSS&at_campaign=KARANGA
|
England in Bangladesh Alex Hales sits out tour but Rehan Ahmed and Tom Abell pickedSomerset batter Tom Abell and Leicestershire leg spinner Rehan Ahmed are named in England s squad for their white ball tour of Bangladesh |
2023-02-02 11:04:22 |
IT |
週刊アスキー |
コメダと白い恋人がコラボ!共に46年目の奇跡「シロノワール 白い恋人」登場 |
https://weekly.ascii.jp/elem/000/004/123/4123275/
|
白い恋人 |
2023-02-02 20:30:00 |
コメント
コメントを投稿