Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed May 7, 2015
1 parent f32a81e commit 353dbf2
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
## js判断是否断网了
# js判断是否断网了

[![GitHub issues](https://img.shields.io/github/issues/jaywcjlove/onlinenetwork.svg)](https://github.com/jaywcjlove/onlinenetwork/issues) [![GitHub forks](https://img.shields.io/github/forks/jaywcjlove/onlinenetwork.svg)](https://github.com/jaywcjlove/onlinenetwork/network) [![GitHub stars](https://img.shields.io/github/stars/jaywcjlove/onlinenetwork.svg)](https://github.com/jaywcjlove/onlinenetwork/stargazers)

此方法是通过 `online``offline` 事件来侦听是否断网,但是这个在 `IE ``Firefox` 中,并非断网了就是真的断网了。(如火狐中在选择 `菜单>>文件>>脱机工作`才会触发 `online``offline` 事件)

总之在`IE``Firefox`中一般情况下不能触发这俩事件,只有在选择脱机状态下才能触发此事件。

### 引用 `online.js`
## 下载

```
$ bower info onlinenetwork
```

## 引用 `online.js`

```html
<script type="text/javascript" src="online.js"></script>
```

### 设置轮询时间和地址
## 设置轮询时间和地址
> time: 时间不设置默认2000
> url:不设置默认所有浏览器用 `online``offline`事件
Expand All @@ -23,15 +29,15 @@ var net = onlinenetwork({
})
```

### 连上网络执行
## 连上网络执行

```js
net.onLineHandler(function(){
console.log("连上了!")
})
```

### 断开网络执行
## 断开网络执行

```js
net.offLineHandler(function(){
Expand Down

0 comments on commit 353dbf2

Please sign in to comment.