root
, path
, base
.
Every url in spoova framework is rendered based on these named divisions.
Localhost: http://localhost/spoova/docs/functions/core Remote Url: http://some_site.com/docs/functions/core
window('root')
: The first path that exists after the domain name. This will be equivalent to "docs"
window('path')
: The paths that comes after root path. This will be equivalent to "functions/core"
window('base')
: All paths that comes after the assumed domain. This is equivalent to "docs/functions/core"
window('root')
is window(':')
as they both return the same value.
Also, in the course of this tutorial, the word domain
will be used as a general representation for
localhost/spoova
and some_site.com
.
window()
function supports path binding which usually involve the prepending of window options returned value with the
specified path supplied along with the argument. Examples of these are shown below:
window('root:user'); http://domain/docs/user
window(':user'); //same as above
window(':user.profile'); http://domain/docs/user/profile
window('base:user'); http://domain/docs/functions/core/user
window()
function converts dots to slashes but this
can be prevented by setting the second argument to true as shown below:
window(':user.profile', true); http://domain/docs/user.profile