Skip to main content

Lecture page navigation

You can put "Previous · Next" buttons in the content to move to other lecture pages of the course. The content doesn't know the table of contents, so it asks and instructs the learning page through messages.

const nav = sdk.navigation;

prevButton.hidden = !(await nav.getHasPrevious()); // 첫 페이지면 false
nextButton.hidden = !(await nav.getHasNext()); // 마지막 페이지면 false

prevButton.addEventListener('click', () => nav.previous());
nextButton.addEventListener('click', () => nav.next());
nav.navigate(53054656); // 같은 과목의 특정 수업 페이지로
MethodDescription
getHasPrevious()true if there is a previous lecture page
getHasNext()true if there is a next lecture page
previous()Moves to the previous lecture page
next()Moves to the next lecture page
navigate(lecturePageId)Moves to a specific lecture page in the same course
  • Available only on learning screens (learn · instructor). On the settings screen it fails with screen_not_supported.
  • getHasPrevious() · getHasNext() wait up to 1 second for the learning page's answer. If there is no answer, it fails with navigation_timeout.
  • In edit page previews, or when opened directly outside an iframe, navigation requests are ignored and false is returned.

Message format​

Messages the SDK exchanges with the learning page have the form { source: 'eliceio-content-sdk', type, materialId, requestId?, payload? }.

  • type: navigate-prev · navigate-next · navigate (payload.lecturePageId) · navigate-state-sync (requestId)
  • The learning page answers with navigate-state and payload { hasPreviousLecturePage, hasNextLecturePage } using the same requestId.
  • The SDK only accepts answers sent by the parent window.