update docs about config: m.route
This commit is contained in:
parent
51d073e414
commit
f0b20da30a
3 changed files with 11 additions and 3 deletions
|
|
@ -389,7 +389,7 @@ See [`m()`](mithril.md) for more information on virtual elements.
|
|||
[How to read signatures](how-to-read-signatures.md)
|
||||
|
||||
```clike
|
||||
void route(DOMElement element, Boolean isInitialized)
|
||||
void route(DOMElement element, Boolean isInitialized, Object context, Object vdom)
|
||||
```
|
||||
|
||||
- **DOMElement element**
|
||||
|
|
@ -399,3 +399,11 @@ void route(DOMElement element, Boolean isInitialized)
|
|||
- **Boolean isInitialized**
|
||||
|
||||
the method does not run if this flag is set to true. This is to make the method compatible with virtual DOM elements' `config` attribute (see [`m()`](mithril))
|
||||
|
||||
- **Object context**
|
||||
|
||||
an object that retains its state across redraws
|
||||
|
||||
- **Object vdom**
|
||||
|
||||
The virtual DOM data structure to which the config is applied to
|
||||
|
|
|
|||
2
mithril.d.ts
vendored
2
mithril.d.ts
vendored
|
|
@ -29,7 +29,7 @@ declare module _mithril {
|
|||
<T extends MithrilController>(rootElement: HTMLDocument, defaultRoute: string, routes: MithrilRoutes<T>): void;
|
||||
<T extends MithrilController>(rootElement: Element, defaultRoute: string, routes: MithrilRoutes<T>): void;
|
||||
|
||||
(element: Element, isInitialized: boolean): void;
|
||||
(element: Element, isInitialized: boolean, context: Object, vdom: Object): void;
|
||||
(path: string, params?: any, shouldReplaceHistory?: boolean): void;
|
||||
(): string;
|
||||
|
||||
|
|
|
|||
|
|
@ -700,7 +700,7 @@ var m = (function app(window, undefined) {
|
|||
var element = arguments[0];
|
||||
var isInitialized = arguments[1];
|
||||
var context = arguments[2];
|
||||
element.href = (m.route.mode !== 'pathname' ? $location.pathname : '') + modes[m.route.mode] + (this.attrs ? this.attrs.href : '');
|
||||
element.href = (m.route.mode !== 'pathname' ? $location.pathname : '') + modes[m.route.mode] + vdom.attrs.href;
|
||||
if (element.addEventListener) {
|
||||
element.removeEventListener("click", routeUnobtrusive);
|
||||
element.addEventListener("click", routeUnobtrusive)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue