From aa541bff7953eaa319cd3c566cf40fee1038b5b2 Mon Sep 17 00:00:00 2001 From: Leo Horie Date: Fri, 10 Apr 2015 22:32:54 -0400 Subject: [PATCH] document vdom arg in config --- docs/mithril.md | 10 +++++++--- mithril.d.ts | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/mithril.md b/docs/mithril.md index 73138b63..52aae7c5 100644 --- a/docs/mithril.md +++ b/docs/mithril.md @@ -13,7 +13,7 @@ - [Dealing with focus](#dealing-with-focus) - [Dealing with sorting and deleting in lists](#dealing-with-sorting-and-deleting-in-lists) - [Signature](#signature) - +- [The `config` attribute](#the-config-attribute) --- This is a convenience method to compose virtual elements that can be rendered via [`m.render()`](mithril.render.md). @@ -475,7 +475,7 @@ VirtualElement m(String selector [, Attributes attributes] [, Children... childr where: VirtualElement :: Object { String tag, Attributes attributes, Children children } - Attributes :: Object + Attributes :: Object Children :: String text | VirtualElement virtualElement | Component | SubtreeDirective directive | Array Component :: Object { Function? controller, Function view } SubtreeDirective :: Object { String subtree } @@ -539,7 +539,7 @@ where: - #### The `config` attribute - **void config(DOMElement element, Boolean isInitialized, Object context)** (optional) + **void config(DOMElement element, Boolean isInitialized, Object context, VirtualElement vdom)** (optional) You can define a non-HTML-standard attribute called `config`. This special parameter allows you to call methods on the DOM element after it gets created. @@ -625,6 +625,10 @@ where: m.render(document, m("a")); //logs `unloaded the div` and `alert` never gets called ``` + + - **VirtualElement vdom** + + The virtual DOM element to which the `config` function is attached - **Children children** (optional) diff --git a/mithril.d.ts b/mithril.d.ts index 2206467e..2625b2f3 100644 --- a/mithril.d.ts +++ b/mithril.d.ts @@ -68,7 +68,7 @@ declare module _mithril { // Configuration function for an element interface MithrilElementConfig { - (element: Element, isInitialized: boolean, context?: any): void; + (element: Element, isInitialized: boolean, context?: any, vdom: MithrilVirtualElement): void; } // Attributes on a virtual element