Skip to content

Commit

Permalink
chore(demo): prevent error when given demo don't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
netil committed Feb 7, 2024
1 parent d4e49ba commit fbb8688
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions demo/chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,6 @@ var billboardDemo = {
* @param {String} type
*/
showDemo: function(type) {
if (!type) {
return;
}

// remove legend
var $legend = document.querySelector(".legend");
$legend && $legend.parentNode.removeChild($legend);
Expand All @@ -158,6 +154,11 @@ var billboardDemo = {

// set description
let desc = demos[type[0]][type[1]];

if (!type || !desc) {
return;
}

this.$description.innerHTML = desc.description || (Array.isArray(desc) && desc[0].description) || "";

this.$codeArea.style.display = "block";
Expand Down

0 comments on commit fbb8688

Please sign in to comment.