Skip to content

Commit

Permalink
bump v1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
nomi-san committed Oct 1, 2023
1 parent 251290d commit f427b5c
Show file tree
Hide file tree
Showing 12 changed files with 113 additions and 26 deletions.
3 changes: 2 additions & 1 deletion .vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,10 @@ function sidebar() {
{ text: '[CommandBar]', link: '/runtime-api/command-bar' },
{ text: '[DataStore]', link: '/runtime-api/data-store' },
{ text: '[Effect]', link: '/runtime-api/effect' },
{ text: '[rcp]', link: '/runtime-api/rcp' },
{ text: '[PluginFS]', link: '/runtime-api/plugin-fs' },
{ text: '[Toast]', link: '/runtime-api/toast' },
{ text: '[rcp] context.rcp', link: '/runtime-api/rcp' },
{ text: 'context.socket', link: '/runtime-api/socket' },
]
},
{
Expand Down
26 changes: 25 additions & 1 deletion docs/guide/javascript-plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,34 @@ in the DevTools and scroll to the top, you will see the output message.
Hello, League Client!
```

## Plugin entry points

<Badge type="tip" text="since v1.1.0" />

A plugin's entry point is an exported function in the plugin index that is called automatically by the loader.
The `init` entry should be called before League Client initializes its scripts.

```js
export function init(context) {
// your code here
}
```
- See [`context.rcp`](../runtime-api/rcp) to use RiotClientPlugin hooks from this `context`.
- See [`context.socket`](../runtime-api/socket.md) to use built-in socket observation.

As of v1.1.0, you no longer need to put your load script in the `load` event of `window`.
Instead, you can put in the `load` entry, it will be called even after window is loaded.

```js
export function load() {
// your code here
}
```

## Plugin templates

To get started with ease, we have already provided base plugins, check it out:
https://github.com/PenguLoader/PenguLoader/tree/main/plugins
https://github.com/PenguLoader/PenguLoader/tree/v1.0.5/plugins

## What's next?

Expand Down
6 changes: 6 additions & 0 deletions docs/guide/lcu-request.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ Send `6` to unsubscribe from a specific API call, or `OnJsonApiEvent` for all.
socket.send(JSON.stringify([6, '<EventName>']))
```

::: tip

Since v1.1.0, we have introduced [`context.socket`](../runtime-api/socket) to for easier socket observation.

:::

## Unauthenticated issue

In some cases that the Ux loads faster than the LCU server, many API that
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/module-system.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ console.log(config.enabled) // false

## TOML and YAML module

Since v1.0.6, TOML and YAML formats are supported. They are easy to read and
Since v1.1.0, TOML and YAML formats are supported. They are easy to read and
solve the JSON brackets hell, as well as the trailing comma problem.

```js
Expand Down
8 changes: 4 additions & 4 deletions docs/runtime-api/command-bar.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# CommandBar

Since v1.0.6, we bring to you a new Command Bar
Since v1.1.0, we bring to you a new Command Bar
that can provide access to app-level commands
and can be used with any navigation pattern.

Expand All @@ -21,7 +21,7 @@ To add your custom actions, please use the APIs below.
## CommandBar.addAction

<Badge type="info" text="function" />
<Badge type="tip" text="since v1.0.6" />
<Badge type="tip" text="since v1.1.0" />

```ts
function addAction(action: Action): void
Expand Down Expand Up @@ -49,7 +49,7 @@ interface Action {
## CommandBar.show

<Badge type="info" text="function" />
<Badge type="tip" text="since v1.0.6" />
<Badge type="tip" text="since v1.1.0" />

```ts
function show(): void
Expand All @@ -60,7 +60,7 @@ Show the Command Bar programmatically if it was hidden.
## CommandBar.update

<Badge type="info" text="function" />
<Badge type="tip" text="since v1.0.6" />
<Badge type="tip" text="since v1.1.0" />

```ts
function update(): void
Expand Down
4 changes: 2 additions & 2 deletions docs/runtime-api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ window.restartClient()
## window.getScriptPath()

<Badge type="info" text="function" />
<Badge type="tip" text="since v1.0.6" />
<Badge type="tip" text="since v1.1.0" />

Call this function get the current script path.

Expand Down Expand Up @@ -104,7 +104,7 @@ console.log(`You are using Pengu Loader v${window.__llver}`)

::: tip

Since v1.0.6, this property has been deprecated.
Since v1.1.0, this property has been deprecated.
Please use `Pengu.version` instead.

:::
6 changes: 3 additions & 3 deletions docs/runtime-api/pengu.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This namespace provides information about current Pengu version and its settings
## Pengu.version

<Badge type="info" text="string" />
<Badge type="tip" text="since v1.0.6" />
<Badge type="tip" text="since v1.1.0" />

A read-only property that returns the current version of Pengu Loader.

Expand All @@ -17,7 +17,7 @@ console.log(Pengu.version)
## Pengu.superPotato

<Badge type="info" text="boolean" />
<Badge type="tip" text="since v1.0.6" />
<Badge type="tip" text="since v1.1.0" />

A boolean value that indicates the **Super Low Spec Mode** is enabled or not.

Expand All @@ -29,7 +29,7 @@ console.log(Pengu.superPotato)
## Pengu.plugins

<Badge type="info" text="string[ ]" />
<Badge type="tip" text="since v1.0.6" />
<Badge type="tip" text="since v1.1.0" />

An array of plugin entries.

Expand Down
12 changes: 6 additions & 6 deletions docs/runtime-api/plugin-fs.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ All paths passed into this API are relative to the root directory of your plugin
## PluginFS.read(path)

<Badge type="info" text="function" />
<Badge type="tip" text="since v1.0.6" />
<Badge type="tip" text="since v1.1.0" />

Read a file in text mode.

Expand All @@ -46,7 +46,7 @@ const content = await PluginFs.read("./README.md")
## PluginFS.write(path,content,enableAppendMode?)

<Badge type="info" text="function" />
<Badge type="tip" text="since v1.0.6" />
<Badge type="tip" text="since v1.1.0" />

Write to a file in text mode.

Expand Down Expand Up @@ -85,7 +85,7 @@ This API can create a file but can't create a file under a non-existing director
## PluginFS.mkdir(path)

<Badge type="info" text="function" />
<Badge type="tip" text="since v1.0.6" />
<Badge type="tip" text="since v1.1.0" />

Create directories recursively.

Expand All @@ -110,7 +110,7 @@ const bMkdir3 = await PluginFS.mkdir("a\\b/")
## PluginFS.stat(path)

<Badge type="info" text="function" />
<Badge type="tip" text="since v1.0.6" />
<Badge type="tip" text="since v1.1.0" />

Get the status of a file.

Expand Down Expand Up @@ -144,7 +144,7 @@ const stat2 = await PluginFS.stat("a/random.js")
## PluginFS.ls(path)

<Badge type="info" text="function" />
<Badge type="tip" text="since v1.0.6" />
<Badge type="tip" text="since v1.1.0" />

List files and directories under given path.

Expand All @@ -161,7 +161,7 @@ A `Promise` of `undefined` on failure.
## PluginFS.rm(path,recursively?)

<Badge type="info" text="function" />
<Badge type="tip" text="since v1.0.6" />
<Badge type="tip" text="since v1.1.0" />

::: danger

Expand Down
8 changes: 4 additions & 4 deletions docs/runtime-api/rcp.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const rcp = window.rcp
## rcp.preInit(name, callback)

<Badge type="info" text="function" />
<Badge type="tip" text="since v1.0.6" />
<Badge type="tip" text="since v1.1.0" />

Register a callback that will be triggered before the target plugin loads.

Expand Down Expand Up @@ -57,7 +57,7 @@ so your callbacks sometimes will not triggered.
## rcp.postInit(name, callback, blocking?)

<Badge type="info" text="function" />
<Badge type="tip" text="since v1.0.6" />
<Badge type="tip" text="since v1.1.0" />

Register a callback that will be triggered after the target plugin is loaded.
Gives you an opportunity to access the plugin API.
Expand Down Expand Up @@ -87,7 +87,7 @@ preferably witin your plugin's `init` entry. So they will not work after the plu
## rcp.whenInit(name)

<Badge type="info" text="function" />
<Badge type="tip" text="since v1.0.6" />
<Badge type="tip" text="since v1.1.0" />

This function works as same as `postInit` but allows you
to get the target plugin asynchronously and also works even after the plugin is loaded.
Expand Down Expand Up @@ -119,7 +119,7 @@ rcp.whenReady(['rcp-a', 'rcp-b', 'rcp-c'])
## rcp.get(name)

<Badge type="info" text="function" />
<Badge type="tip" text="since v1.0.6" />
<Badge type="tip" text="since v1.1.0" />

Get a RCP plugin synchronously after it's registered in the callbacks map.

Expand Down
56 changes: 56 additions & 0 deletions docs/runtime-api/socket.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# LCU Socket observation

This namespace helps you to observe specific LCU APIs without creating a new WebSocket.
You cannot get it directly from `window`, instead use the context of the [`init` entry point](../guide/javascript-plugin#plugin-entry-points).

## socket.observe(api, listener)

<Badge type="info" text="function" />
<Badge type="tip" text="since v1.1.0" />

```ts
function observe(
api: string,
listener: ApiListener
): { disconnect: () => void }

interface EventData {
data: any
uri: string
eventType: 'Create' | 'Update' | 'Delete'
}

interface ApiListener {
(message: EventData): void
}
```

Subscribe a listener to listen when the given API endpoint get called.

### Params:

- `api` a string that presents a LCU API endpoint.
- `listener` a function that gets called with one data param.

### Return value:

An object with a prop `disconnect` that could be called to disconnect the observer.

Example:

```js
socket.observe('/lol-matchmaking/v1/ready-check', (data) => {
doAcceptReadyCheck()
})
```

## socket.disconnect(api, listener)

<Badge type="info" text="function" />
<Badge type="tip" text="since v1.1.0" />

```ts
function disconnect(api: string, listener: ApiListener)
```

Disconnect a subscribed listener. The function parameters like the function above.
6 changes: 3 additions & 3 deletions docs/runtime-api/toast.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This namespace is used to push your toast notifications onto the League Client s
## Toast.success(message)

<Badge type="info" text="function" />
<Badge type="tip" text="since v1.0.6" />
<Badge type="tip" text="since v1.1.0" />

```ts
function success(message: string): void
Expand All @@ -26,7 +26,7 @@ Toast.success('Welcome to my theme!')
## Toast.error(message)

<Badge type="info" text="function" />
<Badge type="tip" text="since v1.0.6" />
<Badge type="tip" text="since v1.1.0" />

```ts
function error(message: string): void
Expand All @@ -47,7 +47,7 @@ Toast.error('Oops! Something went wrong.')
## Toast.promise(promise, msg)

<Badge type="info" text="function" />
<Badge type="tip" text="since v1.0.6" />
<Badge type="tip" text="since v1.1.0" />

```ts
function promise(promise: Promise<T>, msg: {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pengu-docs",
"version": "1.0.6",
"version": "1.1.0",
"description": "Pengu Loader docs",
"license": "MIT",
"type": "module",
Expand Down

0 comments on commit f427b5c

Please sign in to comment.