npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@flowlist/js-core

v2.3.1

Published

flowlist frontend javascript core

Downloads

32

Readme

@flowlist/js-core

信息流业务通用容器的基础实现

Download

yarn add @flowlist/js-core

Import

import flow from '@flowlist/js-core'

Inject

  • getter:get state

Vuex.getter

  • setter:set state

如:React.setState

  • cache:cache instance

包含 get,set,del 三个方法

  • api:named api list

把需要调用的所有 API export 出来

Methods

  • initState

初始化数据容器

| 参数 | 类型 | 介绍 | | --- | --- | --- | | getter | Function | 设置 state 的函数 | | setter | Function | 读取 state 的函数 | | func | String | API层的函数名 | | type | String<ListType> | 列表的类型 | | query | Object | 需要额外透传给 API 层的数据 |

  • initData

加载首屏数据

| 参数 | 类型 | 介绍 | | --- | --- | --- | | getter | Function | 设置 state 的函数 | | setter | Function | 读取 state 的函数 | | cache | Object | 用于读写缓存的对象 | | func | String | API层的函数名 | | type | String<ListType> | 列表的类型 | | query | Object | 需要额外透传给 API 层的数据 | | api | Array<API> | 整个 API 层 | | cacheTimeout | Integer | 缓存持久化的时间(秒) | | uniqueKey | String | 列表里每个元素独一无二的 key | | callback | Function | 请求成功之后的回调函数 |

  • loadMore

加载分页数据

| 参数 | 类型 | 介绍 | | --- | --- | --- | | getter | Function | 设置 state 的函数 | | setter | Function | 读取 state 的函数 | | cache | Object | 用于读写缓存的对象 | | func | String | API层的函数名 | | type | String<ListType> | 列表的类型 | | query | Object | 需要额外透传给 API 层的数据 | | api | Array<API> | 整个 API 层 | | cacheTimeout | Integer | 缓存持久化的时间(秒) | | uniqueKey | String | 列表里每个元素独一无二的 key | | errorRetry | Boolean | 是否是重试 | | callback | Function | 请求成功之后的回调函数 |

  • updateState

更新数据容器

flow.updateState({ getter, setter, cache, type, func, query, method, value, id, uniqueKey, changeKey, cacheTimeout })

| 参数 | 类型 | 介绍 | | --- | --- | --- | | getter | Function | 设置 state 的函数 | | setter | Function | 读取 state 的函数 | | cache | Object | 用于读写缓存的对象 | | func | String | API层的函数名 | | type | String<ListType> | 列表的类型 | | query | Object | 需要额外透传给 API 层的数据 | | method | String | 需要调用的函数名 | | value | Any | 传值 | | id | String / Number | 用来索引的独一无二的 keyValue | | uniqueKey | String | 列表里每个元素独一无二的 keyName | | changeKey | String | 你想要修改的field是哪个字段,默认是result | | cacheTimeout | Integer | 缓存持久化的时间(秒) |