Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@little-saga/rx-hooks
Advanced tools
更好用的 RxJS+React hooks 集成方案。以及一些好用的工具函数!
https://zhuanlan.zhihu.com/p/92248348
Novel
在 @little-saga/rx-hooks,Novel 是一种满足特定接口的函数。开发者将自定义的逻辑封装为相应的 novel,然后调用 useMemoNovel 函数,使 novel 运行在一个 React 组件的生命周期内(基于 React hooks 机制)。
Novel 内的逻辑一般采用 RxJS 编程,@little-saga/rx-hooks 不对 novel 内部的逻辑进行限制,开发者可以选用自己熟悉的 RxJS 开发方式。而 Novel 的输入/输出(即函数的参数和返回值)则需要满足下面描述的要求。
type Novel<I, S extends object, D extends object, E> = (
input$: Observable<I>,
state$: Observable<S>,
) =>
| Observable<S>
| {
nextState?: Observable<S>
derived?: Observable<D>
exports?: E
teardown?(): void
}
React -> RxJS
的通信过程input$
和 state$
BehaviorSubject<I>
useMemoNovel(input, initState, novel)
中的 input 参数RxJS -> React
的通信过程useMemoNovel(input: I, initState: S, novel: Novel<I, S, D, E>) => [S & D, E]
泛型参数说明:
I
input 参数的类型S
state 参数的类型D
novel 返回值中 derived 字段的类型E
novel 返回值中 exports 字段的类型useMemoNovel 将在一个 React 组件内执行 novel 函数,并将 novel 的输入输出与 React 组件绑定起来。注意 useMemoNovel 是一个 React hooks,调用该函数需要遵循 hooks rules.
useMemoNovel 会返回一个数组,数组的长度固定为 2,第一个元素是 state 与 derived 两个对象的合并结果,第二个元素即为 novel 返回对象的 exports 字段。
useMemoNovel
和 useMemoNovel
相似,但是 novel 函数会在 useEffect 会被调用
FAQs
RxJS hooks for React and its friends.
The npm package @little-saga/rx-hooks receives a total of 1 weekly downloads. As such, @little-saga/rx-hooks popularity was classified as not popular.
We found that @little-saga/rx-hooks demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.