Skip to content

Commit

Permalink
docs(core): tidy up the description of resolveComponentResources() (#…
Browse files Browse the repository at this point in the history
…28055) (#28736)

There were a number of typos and some of the sentences did not
read well.

PR Close #28055

PR Close #28736
  • Loading branch information
petebacondarwin authored and AndrewKushnir committed Mar 4, 2019
1 parent ee6498f commit cf916a0
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions packages/core/src/metadata/resource_loading.ts
Expand Up @@ -18,18 +18,18 @@ import {Component} from './directives';
* selector: 'my-comp',
* templateUrl: 'my-comp.html', // This requires asynchronous resolution
* })
* class MyComponnent{
* class MyComponent{
* }
*
* // Calling `renderComponent` will fail because `MyComponent`'s `@Compenent.templateUrl`
* // needs to be resolved because `renderComponent` is synchronous process.
* // renderComponent(MyComponent);
* // Calling `renderComponent` will fail because `renderComponent` is a synchronous process
* // and `MyComponent`'s `@Component.templateUrl` needs to be resolved asynchronously.
*
* // Calling `resolveComponentResources` will resolve `@Compenent.templateUrl` into
* // `@Compenent.template`, which would allow `renderComponent` to proceed in synchronous manner.
* // Use browser's `fetch` function as the default resource resolution strategy.
* // Calling `resolveComponentResources()` will resolve `@Component.templateUrl` into
* // `@Component.template`, which allows `renderComponent` to proceed in a synchronous manner.
*
* // Use browser's `fetch()` function as the default resource resolution strategy.
* resolveComponentResources(fetch).then(() => {
* // After resolution all URLs have been converted into strings.
* // After resolution all URLs have been converted into `template` strings.
* renderComponent(MyComponent);
* });
*
Expand All @@ -38,8 +38,8 @@ import {Component} from './directives';
* NOTE: In AOT the resolution happens during compilation, and so there should be no need
* to call this method outside JIT mode.
*
* @param resourceResolver a function which is responsible to returning a `Promise` of the resolved
* URL. Browser's `fetch` method is a good default implementation.
* @param resourceResolver a function which is responsible for returning a `Promise` to the
* contents of the resolved URL. Browser's `fetch()` method is a good default implementation.
*/
export function resolveComponentResources(
resourceResolver: (url: string) => (Promise<string|{text(): Promise<string>}>)): Promise<null> {
Expand Down

0 comments on commit cf916a0

Please sign in to comment.