演示状态
¥Presentation State
可以使用 getState
方法获取演示文稿的当前状态。状态对象包含将演示文稿恢复到首次调用 getState
时所需的所有信息。有点像快照。它是一个简单的对象,可以轻松地进行字符串化、持久化或通过网络发送。
¥The presentation's current state can be fetched by using the getState
method. A state object contains all of the information required to put the presentation back as it was when getState
was first called. Sort of like a snapshot. It's a simple object that can easily be stringified and persisted or sent over the wire.
// Move to slide 1
Reveal.slide(1);
let state = Reveal.getState();
// {indexh: 1, indexv: 0, indexf: undefined, paused: false, overview: false}
// Move to slide 3
Reveal.slide(3);
// This restores the saved state, placing on slide 1 again
Reveal.setState(state);