From c3e03639ede9aeabf15a5193b58cd5c8d1bcbbb4 Mon Sep 17 00:00:00 2001 From: StefansArya Date: Thu, 24 Jan 2019 14:28:46 +0700 Subject: [PATCH] Fix and and add more information to readme --- README.md | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index b490cdb..9f75a2f 100644 --- a/README.md +++ b/README.md @@ -97,15 +97,15 @@ sf.router.goto('/user/home', data = {}, method = 'get'); Define event listener when element with attributes `sf-page="todo/page"` was loaded to current DOM. The defined event will being called after all model and controller was finished. ```js -sf.router.before('todo/page', function(ModelRoot){ +sf.router.before('todo/page', function(root){ // Data Re-initialization - var self = ModelRoot('todo.page'); // sf.model.root['todo.page'] + var self = root('todo.page'); // sf.model.root['todo.page'] }); ``` Define event listener when element with attributes `sf-page="todo/page"` is going to be removed from DOM. ```js -sf.router.after('todo/page', function(ModelRoot){ +sf.router.after('todo/page', function(root){ // Data cleanup }); ``` @@ -123,6 +123,19 @@ sf.router.on('error', function(e) { }); ``` +When you're using router, every click on an element with link or `href` will trigger the router feature. And the whole HTML `body` content will be changed. But if you only want to change specific content, you should define the default view point. + +```html + + + +Go to todo page +Default page load + +``` + ### Controller Controller is used for controling your model, so this would have a list of your static function. @@ -265,7 +278,7 @@ These addional feature can be used after DOM element was binded. #### hardRefresh Redraw all element at once ```js -myArray..hardRefresh(); +myArray.hardRefresh(); ``` #### softRefresh @@ -372,7 +385,7 @@ var $elem = $(elements); self.list.$virtual.scrollTo(8); // Recalculate scroll bounding -self.list.$virtual.refresh(8); +self.list.$virtual.refresh(); // This will be available on static element height // Get an offset that can be used for `scrollTop`