Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(common): do not duplicate ng optimized preload tags
Do not duplicate the preload `<link>` tags for images that show up more than once and throw a `RuntimeError` if there are too many preloaded images.
- Loading branch information
1 parent
e543005
commit fce5fb8
Showing
8 changed files
with
100 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
packages/common/src/directives/ng_optimized_image/tokens.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** | ||
* @license | ||
* Copyright Google LLC All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
|
||
import {InjectionToken} from '@angular/core'; | ||
|
||
const DEFAULT_PRELOADED_IMAGES_LIMIT = 5; | ||
|
||
export interface NgOptimizedImageConfig { | ||
maxPreloadedImages: number; | ||
} | ||
|
||
export const NG_OPTIMIZED_IMAGE_CONFIG = | ||
new InjectionToken<NgOptimizedImageConfig>('NG_OPTIMIZED_IMAGE_CONFIG', { | ||
providedIn: 'root', | ||
factory: () => | ||
({maxPreloadedImages: DEFAULT_PRELOADED_IMAGES_LIMIT, preconnectCheckBlocklist: []}) | ||
}); | ||
|
||
export const PRELOADED_IMAGES = new InjectionToken<Set<string>>( | ||
'NG_OPTIMIZED_PRELOADED_IMAGES', {providedIn: 'root', factory: () => new Set<string>()}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters