routelist

package
v0.0.0-...-aecb3d9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2018 License: MIT Imports: 2 Imported by: 0

README

routelist

Manage your single page application's routes with an list of paths.

An path eg. /main/item/12 is represented as an linked list

route := routelist.New()

//automatically parses the actual route
route.Path //equals "main"
route.Tail.Path //equals "item"
route.Tail.Tail.Path //equals "12"

It can be easily integrated to the golymer data bindings and the dom-switch element, for showing the right element just by setting the path.

<dom-switch id="domSwich" val="[[Route.Path]]">
	<div id="div1" val="div1">1</div>
	<div id="div2" val="div2">2</div>
	<dom-switch id="domSwich2" val="[[Route.Tail.Path]]">
		<div id="div3" val="div3">3</div>
		<div id="div4" val="div4">4</div>
	</dom-switch>
</dom-switch>

eg. setting the path to /div1 will show the #div1 element.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RouteList

type RouteList struct {
	Path string
	Tail *RouteList
	// contains filtered or unexported fields
}

RouteList represents the document.location.pathname parsed to an List-like object

func New

func New() *RouteList

New returns new RouteList with parsed actual document.location.pathname

func (*RouteList) Set

func (r *RouteList) Set(path string)

Set sets the current RouteList's path location; for Tail routes it sets just the subpath

func (*RouteList) String

func (r *RouteList) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL