You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by da...@apache.org on 2017/09/24 04:04:33 UTC
[1/3] incubator-weex git commit: + [doc] add docs for weex.supports
Repository: incubator-weex
Updated Branches:
refs/heads/0.16-dev 3f0ddca09 -> cfc439359
+ [doc] add docs for weex.supports
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/574b1fea
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/574b1fea
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/574b1fea
Branch: refs/heads/0.16-dev
Commit: 574b1feac916c513fd373787ee324c93ae1c97cf
Parents: 3b1c8c5
Author: Hanks <zh...@gmail.com>
Authored: Mon Jul 3 13:32:13 2017 +0800
Committer: Hanks <zh...@gmail.com>
Committed: Mon Jul 3 13:32:13 2017 +0800
----------------------------------------------------------------------
doc/source/cn/references/weex-variable.md | 45 ++++++++++++++++++++++++
doc/source/references/weex-variable.md | 48 ++++++++++++++++++++++++--
2 files changed, 91 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/574b1fea/doc/source/cn/references/weex-variable.md
----------------------------------------------------------------------
diff --git a/doc/source/cn/references/weex-variable.md b/doc/source/cn/references/weex-variable.md
index 4630681..4660d46 100644
--- a/doc/source/cn/references/weex-variable.md
+++ b/doc/source/cn/references/weex-variable.md
@@ -45,3 +45,48 @@ has_chapter_content: true
## `weex.document: Document`
返回当前 Weex 页面的文档对象。
+
+## `weex.supports`
+<span class="weex-version">v0.15+</span>
+
+`weex.supports` 可以用来检测当前环境中是否支持某个特性。
+
+### API
+
+```js
+weex.supports(condition : String) : Boolean | Null
+```
+
+#### 参数
+
++ 特定格式的字符串:`@{type}/{name}`。
+
+`type` 必须是 "component" 或者 "module"。`name` 可以是标签名、模块名,也可以指定模块中的某个方法名(和模块名用 `.` 隔开)。
+
+#### 返回值
+
++ 支持,则返回 `true`。
++ 不支持,则返回 `false`。
++ 参数格式错误或无法确定是否支持,则返回 `null`。
+
+### 例子
+
+```js
+// 检测是否支持某个组件
+weex.supports('@component/slider') // true
+weex.supports('@component/my-tab') // false
+
+// 检测是否支持某个模块
+weex.supports('@module/stream') // true
+weex.supports('@module/abcdef') // false
+
+// 检测是否支持模块中的某个方法
+weex.supports('@module/dom.getComponentRect') // true
+weex.supports('@module/navigator.jumpToPage') // false
+
+// 无效的输入
+weex.supports('div') // null
+weex.supports('module/*') // null
+weex.supports('@stream/fetch') // null
+weex.supports('getComponentRect') // null
+```
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/574b1fea/doc/source/references/weex-variable.md
----------------------------------------------------------------------
diff --git a/doc/source/references/weex-variable.md b/doc/source/references/weex-variable.md
index b55eef5..19e0858 100644
--- a/doc/source/references/weex-variable.md
+++ b/doc/source/references/weex-variable.md
@@ -9,7 +9,7 @@ version: 2.1
Each Weex page has a separate weex variable, which exists in the JS context. They hold a single instance or method of the current Weex page.
-`weex.config`
+## `weex.config`
This variable contains all the environment information for the current Weex page, including not only:
@@ -42,6 +42,50 @@ Get all the methods of a native module, such as:
```
-`weex.document: Document`
+## `weex.document: Document`
Returns the document object of the current Weex page.
+
+## `weex.supports`
+
+`weex.supports` is a method used to detect whether a feature is supported in the current environment.
+
+### API
+
+```js
+weex.supports(condition : String) : Boolean | Null
+```
+
+#### Parameter
+
++ a formatted string: `@{type}/{name}`.
+
+The `type` must be "component" or "module", the `name` can be tag name, module name or the method name in specific module.
+
+#### Return Value
+
++ if supported, returns `true`.
++ if unsupported, returns `false`.
++ if unclear, returns `null`.
+
+### Example
+
+```js
+// Detects whether the specific component is supported
+weex.supports('@component/slider') // true
+weex.supports('@component/my-tab') // false
+
+// Detects whether the specific module is supported
+weex.supports('@module/stream') // true
+weex.supports('@module/abcdef') // false
+
+// Detects whether the method in specific module is supported
+weex.supports('@module/dom.getComponentRect') // true
+weex.supports('@module/navigator.jumpToPage') // false
+
+// invalid input
+weex.supports('div') // null
+weex.supports('module/*') // null
+weex.supports('@stream/fetch') // null
+weex.supports('getComponentRect') // null
+```
[2/3] incubator-weex git commit: * [doc] add notes of weex.supports
Posted by da...@apache.org.
* [doc] add notes of weex.supports
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/1c47610d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/1c47610d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/1c47610d
Branch: refs/heads/0.16-dev
Commit: 1c47610dfaeb74542f27557429fea6f6a1a6a100
Parents: 574b1fe
Author: Hanks <zh...@gmail.com>
Authored: Tue Jul 4 14:58:11 2017 +0800
Committer: Hanks <zh...@gmail.com>
Committed: Tue Jul 4 14:58:11 2017 +0800
----------------------------------------------------------------------
doc/source/cn/references/weex-variable.md | 3 +++
doc/source/references/weex-variable.md | 4 ++++
2 files changed, 7 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/1c47610d/doc/source/cn/references/weex-variable.md
----------------------------------------------------------------------
diff --git a/doc/source/cn/references/weex-variable.md b/doc/source/cn/references/weex-variable.md
index 4660d46..8deef5f 100644
--- a/doc/source/cn/references/weex-variable.md
+++ b/doc/source/cn/references/weex-variable.md
@@ -47,10 +47,13 @@ has_chapter_content: true
返回当前 Weex 页面的文档对象。
## `weex.supports`
+
<span class="weex-version">v0.15+</span>
`weex.supports` 可以用来检测当前环境中是否支持某个特性。
+> 目前仅在 Weex DSL 2.0 (.vue) 中支持。
+
### API
```js
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/1c47610d/doc/source/references/weex-variable.md
----------------------------------------------------------------------
diff --git a/doc/source/references/weex-variable.md b/doc/source/references/weex-variable.md
index 19e0858..4725c6e 100644
--- a/doc/source/references/weex-variable.md
+++ b/doc/source/references/weex-variable.md
@@ -48,8 +48,12 @@ Returns the document object of the current Weex page.
## `weex.supports`
+<span class="weex-version">v0.15+</span>
+
`weex.supports` is a method used to detect whether a feature is supported in the current environment.
+> Only supported in Weex DSL 2.0 (.vue).
+
### API
```js
[3/3] incubator-weex git commit: Merge branch 'doc-feature-supports'
of https://github.com/Hanks10100/incubator-weex into 0.16-dev
Posted by da...@apache.org.
Merge branch 'doc-feature-supports' of https://github.com/Hanks10100/incubator-weex into 0.16-dev
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/cfc43935
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/cfc43935
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/cfc43935
Branch: refs/heads/0.16-dev
Commit: cfc43935989a4374173c0d0809bc1ed2033c03e4
Parents: 3f0ddca 1c47610
Author: MrRaindrop <te...@gmail.com>
Authored: Sun Sep 24 12:04:01 2017 +0800
Committer: MrRaindrop <te...@gmail.com>
Committed: Sun Sep 24 12:04:01 2017 +0800
----------------------------------------------------------------------
doc/source/cn/references/weex-variable.md | 48 ++++++++++++++++++++++++
doc/source/references/weex-variable.md | 52 +++++++++++++++++++++++++-
2 files changed, 98 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/cfc43935/doc/source/cn/references/weex-variable.md
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/cfc43935/doc/source/references/weex-variable.md
----------------------------------------------------------------------