Browse Source

Merge pull request #3468 from abpframework/docs/link-to-dom-and-cross-origin-strategies

Fixed Some Mistakes in Lazy Loading Documentation
pull/3469/head
Mehmet Erim 6 years ago
committed by GitHub
parent
commit
9e1b520f92
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      docs/en/UI/Angular/Content-Security-Strategy.md
  2. 4
      docs/en/UI/Angular/Cross-Origin-Strategy.md
  3. 6
      docs/en/UI/Angular/Dom-Strategy.md
  4. 10
      docs/en/UI/Angular/Lazy-Load-Service.md
  5. 14
      docs/en/UI/Angular/Loading-Strategy.md

4
docs/en/UI/Angular/Content-Security-Strategy.md

@ -10,7 +10,7 @@
### constructor(public nonce?: string)
`nonce` enables whitelisting inline script or styles in order to avoid using `unsafe-inline` in [script-src](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/script-src#Unsafe_inline_script) and [style-src](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/style-src#Unsafe_inline_styles) directives.
- `nonce` enables whitelisting inline script or styles in order to avoid using `unsafe-inline` in [script-src](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/script-src#Unsafe_inline_script) and [style-src](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/style-src#Unsafe_inline_styles) directives.
### applyCSP(element: HTMLScriptElement | HTMLStyleElement): void
@ -22,7 +22,7 @@ This method maps the aforementioned properties to the given `element`.
## LooseContentSecurityPolicy
`LooseContentSecurityPolicy` is a class that extends `ContentSecurityStrategy`. It required `nonce` and marks given `<script>` or `<style>` tag with it.
`LooseContentSecurityPolicy` is a class that extends `ContentSecurityStrategy`. It requires `nonce` and marks given `<script>` or `<style>` tag with it.

4
docs/en/UI/Angular/Cross-Origin-Strategy.md

@ -8,8 +8,8 @@
### constructor(public crossorigin: 'anonymous' | 'use-credentials', public integrity?: string)
`crossorigin` is mapped to [the HTML attribute with the same name](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin).
`integrity` is a hash for validating a remote resource. Its use is explained [here](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity).
- `crossorigin` is mapped to [the HTML attribute with the same name](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin).
- `integrity` is a hash for validating a remote resource. Its use is explained [here](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity).
### setCrossOrigin(element: HTMLElement): void

6
docs/en/UI/Angular/Dom-Strategy.md

@ -8,8 +8,8 @@
### constructor(public target?: HTMLElement, public position?: InsertPosition)
`target` is an HTMLElement (_default: document.head_).
`position` defines where the created element will be placed. All possible values of `position` can be found [here](https://developer.mozilla.org/en-US/docs/Web/API/Element/insertAdjacentElement) (_default: 'beforeend'_).
- `target` is an HTMLElement (_default: document.head_).
- `position` defines where the created element will be placed. All possible values of `position` can be found [here](https://developer.mozilla.org/en-US/docs/Web/API/Element/insertAdjacentElement) (_default: 'beforeend'_).
### insertElement(element: HTMLElement): void
@ -54,3 +54,5 @@ Predefined dom strategies are accessible via `DOM_STRATEGY` constant.
## What's Next?
- [LoadingStrategy](./Loading-Strategy.md)
TODO: Place new InsertionStrategy link here.

10
docs/en/UI/Angular/Lazy-Load-Service.md

@ -1,6 +1,6 @@
# How to Lazy Load Scripts and Styles
You can use the `LazyLoadService` in @abp/ng.core package in order to lazy loading scripts and styles in an easy and explicit way.
You can use the `LazyLoadService` in @abp/ng.core package in order to lazy load scripts and styles in an easy and explicit way.
@ -25,7 +25,7 @@ class DemoComponent {
## Usage
You can use the `load` method of `LazyLoadService` to create a `<script>` or `<style>` element in the DOM at the desired position and force the browser to download the target resource.
You can use the `load` method of `LazyLoadService` to create a `<script>` or `<link>` element in the DOM at the desired position and force the browser to download the target resource.
@ -124,9 +124,9 @@ All previously loaded paths are available via this property. It is a simple [Jav
### load(strategy: LoadingStrategy, retryTimes?: number, retryDelay?: number): Observable<Event>
`strategy` parameter is the primary focus here and is explained above.
`retryTimes` defines how many times the loading will be tried again before fail (_default: 2_).
`retryDelay` defines how much delay there will be between retries (_default: 1000_).
- `strategy` parameter is the primary focus here and is explained above.
- `retryTimes` defines how many times the loading will be tried again before fail (_default: 2_).
- `retryDelay` defines how much delay there will be between retries (_default: 1000_).

14
docs/en/UI/Angular/Loading-Strategy.md

@ -1,6 +1,6 @@
# LoadingStrategy
`LoadingStrategy` is an abstract class exposed by @abp/ng.core package. Its instances help you mark inline script or styles as safe in terms of [Content Security Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy).
`LoadingStrategy` is an abstract class exposed by @abp/ng.core package. There are two loading strategies extending it: `ScriptLoadingStrategy` and `StyleLoadingStrategy`. Implementing the same methods and properties, both of these strategies help you define how your lazy loading will work.
@ -10,9 +10,11 @@
### constructor(public path: string, protected domStrategy?: DomStrategy, protected crossOriginStrategy?: CrossOriginStrategy)
`path` is set to `<script>` elements as `src` and `<link>` elements as `href` attribute.
`domStrategy` is the `DomStrategy` that will be used when inserting the created element. (_default: AppendToHead_)
`crossOriginStrategy` is the `CrossOriginStrategy` that will be used on the created element before inserting it. (_default: Anonymous_)
- `path` is set to `<script>` elements as `src` and `<link>` elements as `href` attribute.
- `domStrategy` is the `DomStrategy` that will be used when inserting the created element. (_default: AppendToHead_)
- `crossOriginStrategy` is the `CrossOriginStrategy` that will be used on the created element before inserting it. (_default: Anonymous_)
Please refer to [DomStrategy](./Dom-Strategy.md) and [CrossOriginStrategy](./Cross-Origin-Strategy.md) documentation for their usage.
### createElement(): HTMLScriptElement | HTMLLinkElement
@ -28,13 +30,13 @@ This method creates and returns an observable stream that emits on success and t
## ScriptLoadingStrategy
`ScriptLoadingStrategy` is a class that extends `LoadingStrategy`. It lets you lazy load a script.
`ScriptLoadingStrategy` is a class that extends `LoadingStrategy`. It lets you **lazy load a script**.
## StyleLoadingStrategy
`StyleLoadingStrategy` is a class that extends `LoadingStrategy`. It lets you lazy load a style.
`StyleLoadingStrategy` is a class that extends `LoadingStrategy`. It lets you **lazy load a style**.

Loading…
Cancel
Save