From e564cb257d38c8b30b208383273fdd9309c520bd Mon Sep 17 00:00:00 2001 From: whatever Date: Wed, 27 Nov 2019 14:46:26 -0500 Subject: [PATCH] Updated docs files. --- docs/api-core.md | 13 +++++++++---- docs/api-xhr.md | 4 ++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/docs/api-core.md b/docs/api-core.md index eb07706..7e69b47 100644 --- a/docs/api-core.md +++ b/docs/api-core.md @@ -88,8 +88,8 @@ __void s.clearAutoUpdate ( rootElementId )__ Clear the automatic update behavior of the element with ID ```rootElementId```. -## s.route -__void s.route ( hashUrlRegEx, { root: elementId, component: object })__ +## s.addRoute +__void s.addRoute ( hashUrlRegEx, { root: elementId, component: object })__ Define a hash-based route that will replace element with ID ```elementId```'s content with the specified component on route action. @@ -102,9 +102,9 @@ s.route('user/:userId', { component: new UserProfileComponent(), root: 'divUserP ``` ## s.route -__void s.route ( hashUrl )__ +__void s.route ( hashUrl, params = { } )__ -Navigate to the hash-based route according to a previously defined route. +Navigate to the hash-based route according to a previously defined route. May specify route parameters as an object. Example route call: @@ -128,6 +128,11 @@ Example: console.log(s.getRouteSegments()); // [ 'user', '5' ] ``` +## s.getRouteParams +__object s.getRouteParams()__ + +Returns the current route's parameters as an object. Returns ```{ }``` if there are none. + ## s.version __number s.version ( )__ diff --git a/docs/api-xhr.md b/docs/api-xhr.md index 36d1e23..85fc759 100644 --- a/docs/api-xhr.md +++ b/docs/api-xhr.md @@ -8,9 +8,9 @@ Create a XML HTTP Request (XHR) for the specified URL using the specified method |Request Option |Default |Detail | |------------------|-----------------------|--------------------------------------------| |contentType |```application/json``` |Set ```Content-Type``` request header. | -|data |```''``` |Body of the request. | +|body |```''``` |Body of the request. | |withCredentials |```false``` |Send cookies to 3rd party domains. | -|timeout |```0``` (No timeout) |0 is no timeout. Specified in milliseconds. | +|timeout |```0``` |0 is no timeout. Specified in milliseconds. | |headers |```{}``` |Key/value request headers to set. | On success, returns XMLHttpRequest which has data in ```response``` property like so: