Skip to content

Commit

Permalink
Add query parameters support to DocViewer (#91).
Browse files Browse the repository at this point in the history
  • Loading branch information
Bas van den Berg committed Jan 27, 2021
1 parent 5b3a8f0 commit 6aaf495
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions Windows/DocViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,11 @@ define([
/**
* Creates a popup window that is displaying static documentation content
* @param {string} docId - identifier of the documentation item to be shown
* @param {string} queryParams - query parameters
* @returns {{}} - popup window instance
* @constructor
*/
Module.create = function(docId) {
Module.create = function(docId, queryParams) {

Module.topicStack = [];
Module.topicStackPointer = -1;
Expand Down Expand Up @@ -136,9 +137,16 @@ define([
/**
* Loads the content of the documentation item
* @param {string} docId - documentation item id
* @param {object} queryParams - query parameters.
*/
win.loadDocId = function(docId) {
win.loadDocUrl(Module._docRoot + `/${docId}.html`);
win.loadDocId = function(docId, queryParams) {
let url = Module._docRoot + `/${docId}.html`

if (queryParams) {
let param = $.param(queryParams);
url = `${url}?${param}`;
}
win.loadDocUrl(url);
};

/**
Expand Down Expand Up @@ -203,7 +211,7 @@ define([

_init();

win.loadDocId(docId);
win.loadDocId(docId, queryParams);
};


Expand Down

0 comments on commit 6aaf495

Please sign in to comment.