Repository: incubator-weex-site
Updated Branches:
  refs/heads/master 5168b983c -> 6ab444d5b


* [doc] add application foreground or background event for globalEvent


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex-site/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-weex-site/commit/bf47606a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex-site/tree/bf47606a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex-site/diff/bf47606a

Branch: refs/heads/master
Commit: bf47606a927dd70d9fcf539b8d2b1cffdecde484
Parents: 85e6720
Author: acton393 <zhangxing610...@gmail.com>
Authored: Mon Jan 22 19:47:57 2018 +0800
Committer: acton393 <zhangxing610...@gmail.com>
Committed: Mon Jan 22 19:47:57 2018 +0800

----------------------------------------------------------------------
 source/cn/references/modules/globalevent.md | 21 +++++++++++++++++++++
 source/references/modules/globalevent.md    | 19 +++++++++++++++++++
 2 files changed, 40 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex-site/blob/bf47606a/source/cn/references/modules/globalevent.md
----------------------------------------------------------------------
diff --git a/source/cn/references/modules/globalevent.md 
b/source/cn/references/modules/globalevent.md
index 38c3689..c83c764 100644
--- a/source/cn/references/modules/globalevent.md
+++ b/source/cn/references/modules/globalevent.md
@@ -87,3 +87,24 @@ globalEvent.addEventListener("geolocation", function (e) {
 var globalEvent = weex.requireModule('globalEvent');
 globalEvent.removeEventListener("geolocation");
 ```
+
+## 已有的全局事件
+<span class="weex-version">0.14</span>
+### 应用前后事件
+WeexSDK 对获取应用前后台事件做了支持,开发者
可以在页面内
监听对应的事件,获得应用被前后后这后台,以方便暂停音乐,视频等,只需要指定需要监听的事件名称和回调函数就可以,例如:
+
+```
+var globalEvent = weex.requireModule('globalEvent');
+globalEvent.addEventListener("WXApplicationDidBecomeActiveEvent", function (e) 
{
+  console.log("WXApplicationDidBecomeActiveEvent");
+});
+```
+支持的事件名称
+
+  - WXApplicationDidBecomeActiveEvent  应用被前台的时候触发
+  - WXApplicationWillResignActiveEvent 应用即将被后台时候触发
+
+在 [dotWe 上试一试](http://dotwe.org/vue/5a774e8ce3766c88038cab6fe3331f5b)
+
+>>> 目前只有 platform 为 iOS 和 Android 才能支持。[获取当前 
platform](../weex-variable.html#weex-environment-object)
+

http://git-wip-us.apache.org/repos/asf/incubator-weex-site/blob/bf47606a/source/references/modules/globalevent.md
----------------------------------------------------------------------
diff --git a/source/references/modules/globalevent.md 
b/source/references/modules/globalevent.md
index 9612d60..0253e65 100644
--- a/source/references/modules/globalevent.md
+++ b/source/references/modules/globalevent.md
@@ -88,3 +88,22 @@ var globalEvent = weex.requireModule('globalEvent');
 globalEvent.removeEventListener("geolocation");
 ```
 
+## Built-in global event
+<span class="weex-version">0.14</span>
+### background or foreground event
+You can specify the event name as `WXApplicationDidBecomeActiveEvent ` or 
`WXApplicationWillResignActiveEvent` to obtain application becoming foreground 
or background, so that you can pause your video or music at this time.For 
example
+
+```
+var globalEvent = weex.requireModule('globalEvent');
+globalEvent.addEventListener("WXApplicationDidBecomeActiveEvent", function (e) 
{
+  console.log("WXApplicationDidBecomeActiveEvent");
+});
+```
+
+- `WXApplicationDidBecomeActiveEvent`   fired while application did become 
foreground 
+- `WXApplicationWillResignActiveEvent`  fired while application will become 
background
+
+[have a try at DotWe](http://dotwe.org/vue/5a774e8ce3766c88038cab6fe3331f5b)
+
+>>> this feature only works on iOS and Android platforms, it doesn't work on 
Web. [Obtain your weex platform on weex 
page](../weex-variable.html#weex-environment-object)
+

Reply via email to