Namespace: BeautifulHistory

BeautifulHistory

Version:
  • 0.2.0
Author:
  • monjudoh
Source:
See:

Members

(static) currentIndex :number

history上でinitial setUp位置を0とした現在位置の相対位置
Type:
  • number
Source:

(static) debug :boolean

trueならlog出力を行う。
Type:
  • boolean
Source:

(static) existsPreviousDocument :boolean

現documentに遷移してくる前のdocumentが存在しているかどうか
前のdocumentが存在しているならtrue、存在しないことが分かっているか不明ならfalse
なお、現在の実装では次documentが存在している場合は正確に判定できない。
Type:
  • boolean
Source:

(static) historyId :number

BeautifulHistoryで管理されている範囲のhistoryを指すID。
history.stateに保存されるため、history.stateが消えない限り同じ値になる。
例えばリロードしても保持される。
Type:
  • number
Source:

(static) historySpecifiedStorage :NamespacedWebStorage

historyId毎に独立したstorage
Type:
  • NamespacedWebStorage
Source:

(static) isSupported :boolean

現在使用されている環境でBeautifulHistoryが使用可能であればtrue,不能であればfalse
Type:
  • boolean
Source:

(static) maxIndex :number

BeautifulHistoryで管理されているhistoryの最後尾の、initial setUp位置を0とした相対位置
未初期化時は-1を返す。
Type:
  • number
Source:

Methods

(static) backToPreviousDocument(useCurrentIndexopt)

現documentに遷移してくる前のdocumentまで戻る
useCurrentIndex===true  : currentIndex前が現documentの最初だと言えるのでcurrentIndex + 1戻る
useCurrentIndex===false : 前documentまで戻り現documentから抜けるとcontextが変わり、現documentのJSは実行されなくなるはずなので、
                          popstate eventで再帰的に戻っていくと前documentに戻るまで実行されることが期待されるので、そのようにする。
Parameters:
Name Type Attributes Description
useCurrentIndex boolean <optional>
default:true
Source:

(static) collapse(startIndex, endIndex) → {Promise}

historyの圧縮を行う。
startIndex〜endIndexの履歴をendIndex1個に置き換える。
endIndexが末尾の場合は一つ前に即座に戻るforceBackをpushしておく。
圧縮後、圧縮前のcurrentIndexに対応するindexに移動する。
Parameters:
Name Type Description
startIndex number
endIndex number
Source:
Returns:
Type
Promise

(static) go(index, silentlyopt) → {Promise}

Parameters:
Name Type Attributes Description
index number 遷移先index
silently boolean <optional>
デフォルト値false
Source:
Returns:
Type
Promise

(static) push(type, optionsopt, silentlyopt) → {Promise}

currentIndexの次の位置に新しいcontrollerを追加する。
Parameters:
Name Type Attributes Description
type string
options * <optional>
silently boolean <optional>
Source:
Returns:
Type
Promise

(static) register(type, desc)

BeautifulHistoryで管理するcontrollerのtypeを登録する。登録したtypeはpush/replaceで使用できる。
Parameters:
Name Type Description
type string
desc Object
Source:

(static) replace(type, optionsopt, silentlyopt, initializeopt)

this.currentIndex(初期化の場合は0)の位置のcontrollerを指定したtype/optionsのものに置き換える。
replace元とtypeが同じ場合は保存されたoptionsを置き換えるだけでcontrollerの再作成はしない。
未表示の場合は表示する。
Parameters:
Name Type Attributes Description
type string
options * <optional>
silently boolean <optional>
trueの場合はinfoとstateの書き換えのみ行い表示には反映させない。未指定の場合はfalse。
initialize boolean <optional>
初期化の場合trueを指定する。基本的にアプリケーションコードでは使わない。
Source:

(static) setUp(options) → {Promise}

あるnamespaceでsetUpした後にブラウザ再起動をし初めて同一namespaceでsetUpしたとき、
すなわちHistoryManagerで履歴を管理していたタブがブラウザ再起動によって再度開かれたときの動作はwhenBrowserRestartによって決定される。
  backToPreviousDocument:HistoryManagerで履歴を管理していたdocumentに遷移してくる直前のdocumentまで戻る
  redirect              :redirect用HTMLを使ったハックで履歴を消してリロードする
  none                  :何もしない

- redirectHtmlUrl
- storageTruncate
Parameters:
Name Type Description
options Object
Source:
Returns:
Type
Promise

Type Definitions

factory(parentControlleropt, optionsopt)

controllerを作成する処理
Parameters:
Name Type Attributes Description
parentController * <optional>
push元のcontroller
options * <optional>
Source:

hide(controlleropt, optionsopt)

controllerに紐づくUIコンポーネントを非表示にする処理
Parameters:
Name Type Attributes Description
controller * <optional>
options * <optional>
Source:

show(controlleropt, optionsopt)

controllerに紐づくUIコンポーネントを表示する処理
Parameters:
Name Type Attributes Description
controller * <optional>
options * <optional>
Source: