WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit e1a7d53

Browse files
committed
docs: polish /event-based
1 parent 63cbd89 commit e1a7d53

File tree

1 file changed

+5
-5
lines changed
  • packages/telefunc.com/pages/event-based

1 file changed

+5
-5
lines changed

packages/telefunc.com/pages/event-based/+Page.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Link } from '@brillout/docpress'
22

3-
> **What is this page about?**
3+
> **What is this about?**
44
>
55
> This page explains how to most efficiently use Telefunc (and RPC in general) to significantly increase development speed.
66
>
@@ -18,21 +18,21 @@ With Telefunc, it's usually the opposite — telefunctions are:
1818

1919
This inversion is at the cornerstone of using Telefunc efficiently.
2020

21-
You may be tempted to create generic telefunctions out of habit from REST/GraphQL (or to keep things [DRY](https://softwareengineering.stackexchange.com/questions/400183/what-should-i-consider-when-the-dry-and-kiss-principles-are-incompatible)) but we recommend against it. Instead, we recommend implementing what we call *event-based telefunctions*.
21+
You may be tempted to create generic telefunctions but we recommend against it. Instead, we recommend implementing what we call *event-based telefunctions*.
2222

2323
```ts
2424
// database/todo.telefunc.ts
2525

26-
// ❌ Generic telefunction
27-
export async function updateTask(id: number, modifications: Partial<typeof Task>) {
26+
// ❌ Generic telefunction: one telefunction re-used for multiple use case
27+
export async function updateTask(id: number, modifications: Partial<TodoItem>) {
2828
// ...
2929
}
3030
```
3131

3232
```ts
3333
// components/TodoList.telefunc.ts
3434

35-
// ✅ Event-based telefunctions
35+
// ✅ Event-based telefunctions: one telefunction per use case
3636
export async function onTodoTextUpdate(id: number, text: string) {
3737
// ...
3838
}

0 commit comments

Comments
 (0)