File

src/lib/models/folio.ts

Description

A specialized SzFolio class used for storing the user's search history.

Extends

SzSearchParamsFolio

Index

Properties
Methods
Accessors

Constructor

constructor(items?: SzSearchHistoryFolioItem[])
Parameters :
Name Type Optional
items SzSearchHistoryFolioItem[] Yes

Properties

Public _name
Type : string
Default value : 'Search History'

hardcoded to 'Search History'

items
Type : SzSearchHistoryFolioItem[]

the collection of search parameters used in the last X searches

Public maxItems
Type : number
Default value : 20

The number of searches back to store in the folio

Public updateMode
Type : number
Default value : 1

update mode. when a user searches for something that is already in the search history should the item be moved to the top of the stack, updated in place, or ignored. possible values are -1(ignore), 0(replace), 1(update position)

name
Type : string

the name of the search set

Methods

Public add
add(item: SzSearchHistoryFolioItem, overwrite: boolean)

Add a new search parameter set to the stack

Parameters :
Name Type Optional Default value
item SzSearchHistoryFolioItem No
overwrite boolean No true
Returns : Boolean
exists
exists(item: SzSearchHistoryFolioItem)

whether or not the folio item passed in already exists in collection

Parameters :
Name Type Optional
item SzSearchHistoryFolioItem No
Returns : boolean
Static FolioItemsFromJSON
FolioItemsFromJSON(itemsJson: [])

returns an array of "SzSearchHistoryFolio" that is created from the 'items' model that 'toJSONObject' returns.

Parameters :
Name Type Optional
itemsJson [] No
Returns : SzSearchHistoryFolioItem[]
Public fromJSONObject
fromJSONObject(data: literal type)

set the folios properties via a json model. This is the same model that this.toJSONObject returns

Parameters :
Name Type Optional
data literal type No
Returns : void
indexOf
indexOf(item: SzSearchHistoryFolioItem)

returns the index position of an existing folio item

Parameters :
Name Type Optional
item SzSearchHistoryFolioItem No
Returns : number
Public toJSONObject
toJSONObject()

get a json representation model of this class and its items.

Returns : literal type
Public trimItemsTo
trimItemsTo(len: number, items?: SzSearchHistoryFolioItem[])

used internally to keep stack at appropriate length

Parameters :
Name Type Optional
len number No
items SzSearchHistoryFolioItem[] Yes
Returns : SzSearchHistoryFolioItem[]
Public remove
remove(item)

remove a SzFolioItem from "items" if it exists

Parameters :
Name Optional
item No
Returns : void

Accessors

history
gethistory()

gets the history folio items in decending chronological order

Returns : SzSearchHistoryFolioItem[]

results matching ""

    No results matching ""