Skip to content

Commit

Permalink
clean up reference
Browse files Browse the repository at this point in the history
  • Loading branch information
bates64 committed Oct 11, 2023
1 parent 024bc20 commit dcd4673
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 8 deletions.
4 changes: 3 additions & 1 deletion src/content/docs/cheerpj3/05-reference/00-cheerpjInit.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down Expand Up @@ -177,3 +177,5 @@ cheerpjInit({
### `fetch`

This option is used to make a `fetch` request over the network.

[cjGetRuntimeResources]: /cheerpj3/reference/cjGetRuntimeResources
18 changes: 14 additions & 4 deletions src/content/docs/cheerpj3/05-reference/30-cjGetRuntimeResources.md
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -25,3 +28,5 @@ cjGetProguardConfiguration();
```

This will trigger the download of `cheerpj.pro` file.

[ProGuard]: https://github.com/Guardsquare/proguard

0 comments on commit dcd4673

Please sign in to comment.