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

cmui-subview

v0.1.2

Published

View switching with history support.

Downloads

2

Readme

Subview

View switching with history support.

兼容性

浏览器支持

  • 支持以下移动平台的主流浏览器:

    • iOS 7+
    • Android 4+
  • 同样支持以下桌面浏览器:

    • Firefox (Latest)
    • Chrome (Latest)
    • Safari (Latest)

外部依赖

  • jQuery(或 Zepto 等兼容类库)-- DOM 操作
  • history.state -- history.state 属性的 polyfill
  • Action -- 点击事件绑定

安装

  1. 通过 Bower 安装:

    $ bower install subview
  2. 在页面中加载 Subview 的脚本文件及必要的依赖:

    <script src="bower_components/jquery/dist/jquery.min.js"></script>
    <script src="bower_components/history.state/src/history.state.js"></script>
    <script src="bower_components/action/src/action.js"></script>
    <script src="bower_components/subview/src/subview.js"></script>

使用步骤

Polyfill 与 Fallback

Subview 依赖 HTML5 History API,且依赖 history.state 属性。为了在那些支持前者但不支持后者的浏览器中正常运行,我们需要对后者进行 polyfill。我们采用 history.state 这个类库来完成 polyfill:

historyState.polyfill()

但现实中还存在无法 polyfill 的情况(比如早期的浏览器连基本的 HTML5 History API 都不支持),因此建议你在使用 Subview 之前做好特性检测,并提供 fallback 方案:

if (historyState.isSupported()) {
	// 使用 Subview 提供增强的 UI 效果
} else {
	// Fallback 到基本的 UI 效果
}

初始化

需要在 DOM ready 时调用 Subview 的初始化方法。(参见相关文档

输出 HTML 接口

Subview 预定义了一些动作,可以借助 Action 类库自动完成事件绑定,不需要再手工绑定到 DOM 元素。(参见相关文档

API 文档

所有文档入口在 Wiki 页面,快去看吧!

谁在用?

以下开源项目采用 Subview 作为 UI 组件:

因此,本项目运行在以下网站:


License

MIT License