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

inframejs

v1.1.2

Published

use pure Javascript to connect the iframe pages

Downloads

4

Readme

inframeJS

使用纯JS链接iframe或其他页面
use pure Javascript to connect the iframe pages

基本使用

npm i inframejs

const bridge = new Inframe({...})
beidge.on('some event',()=>{})
bridge.emit('some event')

特点

  • 原生js,无依赖 es6
  • 一个事件可以有多个监听
  • 由子页面触发connected事件,所有事件会从该事件之后开始触发,保证完整性
  • 可适用于简单微前端中使用
  • 已上线

参数 parameters

  • target:any 必需 required window对象,或iframe,或class名,id名
    your target,not only window Object, or iframe element,iframe className, iframe id
  • whiteList:array 非必需 whatever 域名白名单 domain white list,allow this domain to access data
  • libName:string 非必需 whatever 通信时校验名,通信双方需要统一 this string used to verify the connection by this lib
  • debug:boolean 非必需 whatever 是否打印日志 will print some log
  • isSubPage:boolean 是否子页面
    is sub page or be opened page
  • isNewWindow:boolean 是否是新窗口打开
    does it opened by window.open()

方法 methods

  • on(eventName:string,handler:function)
    新增事件监听
    watch some event
  • off(eventName:string) 解除事件监听
    remove some event watcher
  • destroy()
    销毁全部事件
    destroy all event watchers
  • window.getInframeInstace
    获取实列 get Instace

注意事项 notice

  • All cross-domain storage access is disabled by default with Safari 7+,except you open it by yourself. 所有跨站存储在iOS 7+,Safari 7+都是被默认禁止的,除非你手动打开他。
  • recommend https on production 为了保证正常使用,线上环境请使用https