Gapminder / tools-page

Gapminder tools page vanilla
8 stars 5 forks source link

UNDO A SHORTCUT: eval in creating a tool #111

Closed angiehjort closed 4 years ago

angiehjort commented 4 years ago

unsure how we can do it without eval... probably need to register the available tools somehow somewhere (in rollup config?), so that we could do viz = new alltools[toolConfig.tool]

    //TODO: how to do it without eval? we no longer have registry of all the tools, such as in old vizabi
    const toolPrototype = eval(toolConfig.tool);

    //could be: viz = new LineChart({ ...
    viz = new toolPrototype({
      placeholder: document.getElementsByClassName("vzb-placeholder")[0],
      model,
      locale,
      ui
    });
angiehjort commented 4 years ago

since we already have allTools in rollup config and vizabi-tools.json maybe it's a good idea to align every name to be like LineChart instead of linechart

angiehjort commented 4 years ago

fixed in d3859478c90d726f3045ab9e0d7297eb991bd829