aboutsummaryrefslogtreecommitdiff
path: root/thirdparty/preact/src/vdom/functional-component.js
diff options
context:
space:
mode:
authortg(x) <*@tg-x.net>2016-10-05 00:02:10 +0200
committertg(x) <*@tg-x.net>2016-10-05 00:02:10 +0200
commitec62d29c90958aa8d41474ed2fe5a179d6fafed7 (patch)
tree367cc55bc6772cf194ed6c4778cd344d581d3d7c /thirdparty/preact/src/vdom/functional-component.js
parentfda241d74d5c1c39203b64da676c684d4dc9d800 (diff)
parentd3ccf4103900b8d990b1970d135695b938d94eae (diff)
Merge branch 'master' of taler.net:/var/git/wallet-webex
Diffstat (limited to 'thirdparty/preact/src/vdom/functional-component.js')
-rw-r--r--thirdparty/preact/src/vdom/functional-component.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/thirdparty/preact/src/vdom/functional-component.js b/thirdparty/preact/src/vdom/functional-component.js
new file mode 100644
index 000000000..04bc5a464
--- /dev/null
+++ b/thirdparty/preact/src/vdom/functional-component.js
@@ -0,0 +1,25 @@
+import { EMPTY } from '../constants';
+import { getNodeProps } from './index';
+import { isFunction } from '../util';
+
+
+/** Check if a VNode is a reference to a stateless functional component.
+ * A function component is represented as a VNode whose `nodeName` property is a reference to a function.
+ * If that function is not a Component (ie, has no `.render()` method on a prototype), it is considered a stateless functional component.
+ * @param {VNode} vnode A VNode
+ * @private
+ */
+export function isFunctionalComponent(vnode) {
+ let nodeName = vnode && vnode.nodeName;
+ return nodeName && isFunction(nodeName) && !(nodeName.prototype && nodeName.prototype.render);
+}
+
+
+
+/** Construct a resultant VNode from a VNode referencing a stateless functional component.
+ * @param {VNode} vnode A VNode with a `nodeName` property that is a reference to a function.
+ * @private
+ */
+export function buildFunctionalComponent(vnode, context) {
+ return vnode.nodeName(getNodeProps(vnode), context || EMPTY);
+}