Skip to content

Commit

Permalink
docs: update relevant docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Undertone0809 committed Jun 14, 2023
1 parent b8c6e25 commit 01dcedb
Show file tree
Hide file tree
Showing 9 changed files with 801 additions and 58 deletions.
37 changes: 26 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
- Support different application scenarios, such as asynchronous and synchronous
- Provide different syntax writing modes for lambda, callback functions, decorators, etc
- A callback function listens on multiple subscriptions
- Provide publisher dispatch callback manage

## Quick Start
- [document github-pages](https://undertone0809.github.io/broadcast-service/#/)
Expand All @@ -44,12 +45,6 @@ There is an easy demo to show how to use broadcast-service.
```python
from broadcast_service import broadcast_service


# callback of common method
def handle_msg(params):
print(f"handle_msg receive params: {params}")


# callback of decorator
@broadcast_service.on_listen('my_topic')
def handle_decorator_msg(params):
Expand All @@ -58,9 +53,6 @@ def handle_decorator_msg(params):
if __name__ == '__main__':
info = 'This is very important msg'

# subscribe topic
broadcast_service.subscribe('my_topic', handle_msg)

# publish broadcast
broadcast_service.publish('my_topic', info)
```
Expand Down Expand Up @@ -98,7 +90,30 @@ if __name__ == '__main__':
broadcast_service.publish('Test')
```

You can use decorator to subscirbe your
You can use `config` to make publisher callback If you want.

```python
from broadcast_service import broadcast_service


@broadcast_service.on_listen("topic")
def handle_subscriber_callback():
print("handle_subscriber_callback")


def handle_publisher_callback(*args):
print("handle_publisher_callback")


if __name__ == '__main__':
broadcast_service.config(
num_of_executions=5,
callback=handle_publisher_callback,
enable_final_return=True,
interval=0.1
).publish("topic")

```

Moreover, you can see more example in [document](https://undertone0809.github.io/broadcast-service/#/).

Expand All @@ -107,7 +122,7 @@ Moreover, you can see more example in [document](https://undertone0809.github.io
- ~~optimize the syntax expression of broadcast-service~~
- provide more test cases
- provide the ability to subscribe the topic and callback once
- Support for fuzzy subscriptions
- support for fuzzy subscriptions
- ~~the publisher of the topic can provide a return value~~
- optimize usage in class ('self' params problem)
- build observer mode
Expand Down
10 changes: 7 additions & 3 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,13 @@ if __name__ == '__main__':
## TODO
- optimize documents and show more examples.
- ~~optimize the syntax expression of broadcast-service~~
- provide more test cases
- privide the ability to subscribe the topic and callback once
- Support for fuzzy subscriptions
- provide more test cases (developing)
- provide the ability to subscribe the topic and callback once
- support for fuzzy subscriptions
- ~~the publisher of the topic can provide a return value~~
- optimize usage in class ('self' params problem)
- build observer mode
- ~~provide publisher callback when all subscriber have completed callback~~


## Contribution
Expand Down
2 changes: 1 addition & 1 deletion docs/_coverpage.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!-- _coverpage.md -->

# broadcast-service <small>1.2.0</small>
# broadcast-service <small>2.0.0</small>

> A lightweight python broadcast library. You can easily construct a Broadcast pattern/Publish subscriber pattern through this library.
Expand Down
1 change: 1 addition & 0 deletions docs/_sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- Getting started

- [Quick Start](quickstart.md)
- [Publisher Dispatch](publisher_dispatch.md)
- [Async](async.md)
- [Log](log.md)

Expand Down
65 changes: 38 additions & 27 deletions docs/index.html
Original file line number Diff line number Diff line change
@@ -1,36 +1,47 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="description" content="Description">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify@4/lib/themes/vue.css">
<meta charset="UTF-8">
<title>Document</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<meta name="description" content="Description">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify@4/lib/themes/vue.css">
</head>
<body>
<div id="app"></div>
<script>
<div id="app"></div>
<script>
window.$docsify = {
name: 'broadcast-service',
repo: 'https://github.com/Undertone0809/broadcast-service',
loadNavbar: true,
loadSidebar: true,
subMaxLevel: 3,
coverpage: true,
search: {
paths: 'auto',
placeholder: 'Search',
noData: 'Not Found',
depth: 3,
},
name: 'broadcast-service',
repo: 'https://github.com/Undertone0809/broadcast-service',
loadNavbar: true,
loadSidebar: true,
subMaxLevel: 3,
coverpage: true,
search: {
paths: 'auto',
placeholder: 'Search',
noData: 'Not Found',
depth: 3,
},
count: {
countable: true,
fontsize: '0.9em',
color: 'rgb(90,90,90)',
language: 'english'
}
}
</script>
<!-- Docsify v4 -->
<script src="//cdn.jsdelivr.net/npm/docsify@4"></script>
<!-- 搜索插件 -->
<script src="//cdn.jsdelivr.net/npm/docsify/lib/plugins/search.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-bash.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-python.min.js"></script>
</script>
<!-- Docsify v4 -->
<script src="//cdn.jsdelivr.net/npm/docsify@4"></script>
<!-- 搜索插件 -->
<script src="//cdn.jsdelivr.net/npm/docsify/lib/plugins/search.min.js"></script>
<!-- 图片缩放插件 -->
<script src="//cdn.jsdelivr.net/npm/docsify/lib/plugins/zoom-image.min.js"></script>
<!-- 复制剪贴板 -->
<script src="//cdn.jsdelivr.net/npm/docsify-copy-code"></script>
<script src="//unpkg.com/docsify-count/dist/countable.js"></script>
<script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-bash.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-python.min.js"></script>
</body>
</html>
15 changes: 10 additions & 5 deletions docs/plan.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@

Here are some development plans.

- Optimize Chinese documents and show more examples.
- ~~Optimize the syntax expression of broadcast-service~~
- Provide more test cases
- Privide the ability to subscribe the topic and callback once `(developing)`
- Support for fuzzy subscriptions
- optimize documents and show more examples.
- ~~optimize the syntax expression of broadcast-service~~
- provide more test cases (developing)
- provide the ability to subscribe the topic and callback once
- support for fuzzy subscriptions
- ~~the publisher of the topic can provide a return value~~
- optimize usage in class ('self' params problem)
- build observer mode
- ~~provide publisher callback when all subscriber have completed callback~~


`(developing)` means I am going to do. As for other plans,if you want to contribute to this project, you can submit pr or issue and tells me which one you want to do. I am glad to see more people involved and optimize it.
Loading

0 comments on commit 01dcedb

Please sign in to comment.