forked from LeetCode-OpenSource/hire
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request LeetCode-OpenSource#2 from LeetCode-OpenSource/add…
…-rxjs-question doc: add question about rxjs & update readme
- Loading branch information
Showing
2 changed files
with
57 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,35 @@ | ||
# Join us | ||
# Welcome, LeetCoder! | ||
|
||
- [Join US team](#us-team) | ||
- [加入中国团队](#%E5%8A%A0%E5%85%A5%E4%B8%AD%E5%9B%BD%E5%9B%A2%E9%98%9F) | ||
|
||
## US team | ||
|
||
> WIP | ||
# 加入我们 | ||
## 加入中国团队 | ||
|
||
> 完成一个或多个面试题,获取免第一轮面试的面试机会。完成的题目越多,质量越高,在面试中的加分更多。完成后的代码可以任意形式发送给 [email protected]。 | ||
## 中国团队 | ||
|
||
### 前端工程师 | ||
|
||
#### 工作内容 | ||
|
||
LeetCode 中国的前端团队工作内容: | ||
|
||
- [LeetCode 中国](https://leetcode-cn.com) 站点的开发与维护 | ||
- [LeetCode | 领扣](https://leetcode-cn.com) 站点的开发与维护 | ||
|
||
- 维护 Angular1 + jQuery + bootstrap 的 legacy 代码 | ||
- 开发基于 Graphql + React + RxJS + TypeScript 的单页应用 | ||
- 开发基于 GraphQL + React + RxJS + TypeScript 的单页应用 | ||
|
||
- LeetCode 中国企业服务的开发与维护 | ||
- 开发基于 Graphql + React + redux + redux-observable + TypeScript 的单页应用 | ||
- 开发基于 GraphQL + React + redux + redux-observable + TypeScript 的单页应用 | ||
|
||
#### 技术栈 | ||
|
||
- React | ||
- Redux | ||
- Graphql | ||
- GraphQL | ||
- RxJS | ||
- TypeScript | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,50 @@ | ||
# RxJS 题 | ||
|
||
[WIP] | ||
## 题目描述 | ||
|
||
使用 RxJS 6+,实现一个 Autocomplete 组件的基本行为,需满足以下要求: | ||
|
||
1. 用户停止输入 500ms 后,再发送请求; | ||
2. 如果请求没有返回时,用户就再次输入,要取消之前的请求; | ||
3. 不能因为搜索而影响用户正常输入新的字符; | ||
4. 如果用户输入超过 30 个字符,取消所有请求,并显示提示:您输入的字符数过多。 | ||
|
||
你可以直接使用 [编写工程化的组件](./engineering_zh.md) 中写好的 `Autocomplete` 组件完成本题。 | ||
亦可在下方的伪代码中填充你的答案,不要求直接执行,主要考察思路。 | ||
|
||
### 伪 TS 代码 | ||
|
||
```typescript | ||
class AutocompletaController { | ||
/** | ||
* 每次用户输入任意值,都会从 payload$ 流中获得 | ||
* 比如,用户依次输入 a, b, c | ||
* 那么 payload$ 流会获得三个值:"a", "ab", "abc" | ||
*/ | ||
payload$: Subject<string>; | ||
|
||
subscription: Subscription; | ||
|
||
constructor() { | ||
this.subscription = this.getAutoSearch().subscribe(); | ||
} | ||
|
||
// 更新 Input 框中的搜索词 | ||
setSearchStr: (str: string) => void; | ||
// 更新搜索状态 | ||
setLoading: (isLoading: boolean) => void; | ||
// 显示或隐藏警告信息 | ||
toggleWarning: (isShown?: boolean) => void; | ||
// 发送请求,获取搜索结果 | ||
searchQuery: (str: string) => Observable<User[]>; | ||
|
||
// 你要实现的方法 | ||
getAutoSearch() { | ||
const search$ = ( | ||
/* ...你的代码... */ | ||
) | ||
|
||
return search$; | ||
} | ||
} | ||
``` |