From dcd4673abbb9cbd4c8cb45c08a43afc787b2d32f Mon Sep 17 00:00:00 2001 From: Alex Bates Date: Wed, 11 Oct 2023 11:42:16 +0100 Subject: [PATCH] clean up reference --- .../cheerpj3/05-reference/00-cheerpjInit.md | 4 +++- .../05-reference/30-cjGetRuntimeResources.md | 18 ++++++++++++++---- .../31-cjGetProguardConfiguration.md | 11 ++++++++--- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/src/content/docs/cheerpj3/05-reference/00-cheerpjInit.md b/src/content/docs/cheerpj3/05-reference/00-cheerpjInit.md index 42dfdd0f..92610370 100644 --- a/src/content/docs/cheerpj3/05-reference/00-cheerpjInit.md +++ b/src/content/docs/cheerpj3/05-reference/00-cheerpjInit.md @@ -143,7 +143,7 @@ Example: cheerpjInit({ preloadResources: {"/lts/file1.jar":[int, int, ...], "/lts/file2.jar":[int,int, ...]} }); ``` -See also [cjGetRuntimeResources](#cjGetRuntimeResources). +See also [cjGetRuntimeResources]. ### `status` @@ -177,3 +177,5 @@ cheerpjInit({ ### `fetch` This option is used to make a `fetch` request over the network. + +[cjGetRuntimeResources]: /cheerpj3/reference/cjGetRuntimeResources diff --git a/src/content/docs/cheerpj3/05-reference/30-cjGetRuntimeResources.md b/src/content/docs/cheerpj3/05-reference/30-cjGetRuntimeResources.md index 9672c59d..aef1eeca 100644 --- a/src/content/docs/cheerpj3/05-reference/30-cjGetRuntimeResources.md +++ b/src/content/docs/cheerpj3/05-reference/30-cjGetRuntimeResources.md @@ -2,23 +2,30 @@ title: cjGetRuntimeResources --- -Returns a JavaScript string representing the data that should be passed to [preloadResources](/cheerpj3/reference/cheerpjInit#preloadresources). Once parsed, it is an object containing the filenames that have been loaded from the runtime up to the time this function is called. +Returns a JavaScript string representing the data that should be passed to [preloadResources]. Once parsed, it is an object containing the filenames that have been loaded from the runtime up to the time this function is called. + +See [startup time optimization](/cheerpj3/guides/Startup-time-optimization) for more information. ```ts function cjGetRuntimeResources(): string; ``` +> [!note] Note +> This function is intended for use in the browser console. It is not intended to be called from within your application. + ## Parameters -- No parameters +`cjGetRuntimeResources` does not take any parameters. ## Returns -- **`string`** - string representing the files that have been loaded from the runtime. +`cjGetRuntimeResources` returns a string representing the files that have been loaded from the runtime. + +Parse this string with [JSON.parse] and pass it as [preloadResources] in future page loads. ## Example -On the browser console type: +In the browser console, type: ```shell cjGetRuntimeResources(); @@ -29,3 +36,6 @@ The output would look like this: ```js '{"/lts/file1.jar":[int, int, ...], "/lts/file2.jar":[int,int, ...]}'; ``` + +[preloadResources]: /cheerpj3/reference/cheerpjInit#preloadresources +[JSON.parse]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse diff --git a/src/content/docs/cheerpj3/05-reference/31-cjGetProguardConfiguration.md b/src/content/docs/cheerpj3/05-reference/31-cjGetProguardConfiguration.md index de75eb17..0d81c35a 100644 --- a/src/content/docs/cheerpj3/05-reference/31-cjGetProguardConfiguration.md +++ b/src/content/docs/cheerpj3/05-reference/31-cjGetProguardConfiguration.md @@ -2,19 +2,22 @@ title: cjGetProguardConfiguration --- -To be used on the browser console to download a ProGuard configuration file (`cheerpj.pro`). +Triggers download of a configuration file which can be used to tree-shake JARs using [ProGuard]. ```ts function cjGetProguardConfiguration(): void; ``` +> [!note] Note +> This function is intended for use in the browser console. It is not intended to be called from within your application. + ## Parameters -- No parameters are required +`cjGetProguardConfiguration` does not take any parameters. ## Returns -- void +`cjGetProguardConfiguration` does not return a value. It triggers a download of a `cheerpj.pro` file. ## Example @@ -25,3 +28,5 @@ cjGetProguardConfiguration(); ``` This will trigger the download of `cheerpj.pro` file. + +[ProGuard]: https://github.com/Guardsquare/proguard