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

focus-loader

v3.0.2

Published

focus loader

Downloads

13

Readme

react18 is supported now!

focus-center

focus尝试解决的问题:提高业务组件的复用性,让你的团队可以快速的开发或者维护页面的业务逻辑,可以让你的团队把重心放在开发业务组件上。看到这里可能你会有点不明白,作者说的什么东西啊,别急,我会慢慢解释。
现在前端页面的开发早变成了一个个的组件,但是组件应该是和复用性挂钩的,这也是评价一个组件好坏的指标之一。如果业务重复,ui重复,这个时候如果还是在页面写重复的组件,无疑是在浪费工作量,并且据我所知在页面工程上进行组件的维护是一个非常不吃力的做法,并且还会增加整个工程的混乱度,团队还会不停的写着重复的代码。
正确的做法是需要进行业务组件的沉淀,将它从页面工程分离,进行单独的维护,将焦点放在业务组件上,然后再下放到你的页面中。这样做的好处就是可以解放整个团队的生产力。

focus需要结合focus-loader来使用,入口是index.view文件

安装

npm install focus-center focus-loader --save;
// loader 规则从下到上,从右到左,所以focus-loader需要在babel-loader后面
module: {
    rules: [
      {
        test: /\.(js|jsx|tsx)$/,
        use: [{ loader: 'babel-loader' }],
        exclude: /node_modules/,
      },
      {
        test: /\.view$/,
        use: [
          { loader: 'babel-loader' },
          {
            loader: 'focus-loader',
            options: {

            }
          }],
        exclude: /node_modules/,
      },
    ]
  }

tips:一般的你可能会需要配置多个入口文件(src/pageOne/index.view,src/pageTwo/index.view,...)