Skip to content

Example project illustrating the use of the SemLookP widgets in a plain JavaScript environment (non-React)

Notifications You must be signed in to change notification settings

ts4nfdi/JS-Widgets-Demo-Project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JS-Widgets Demo Project

NFDI_SemLookP_Logo.svg

This is an example project illustrating the use of SemLookP's widgets in a plain JavaScript environment. All widgets are created directly inside of index.html. To access the widgets of SemLookP, a bundled javascript output file generated by esbuild in the semlookp-widgets repository is included in this project's js/ folder and embedded in index.html via script tag.

demo_picture.png

Create SemLookP-widgets in a plain JavaScript environment

To create a widget, an empty container with an id has to be created first. This container can then be addressed in a script tag, where the SemLookP widget can now be rendered into with the respective function added to window['SemLookPWidgets']. Here's an example code snippet:

<head>
    <link rel="stylesheet" href="https://unpkg.com/@elastic/eui@62.2.4/dist/eui_theme_light.css">
    <link rel="stylesheet" href="./css/semlookp_widgets.css/">
    <script type="text/javascript" src="./js/semlookp_widgets.js"></script>
</head>
<body>
    <div id="datacontent_widget"></div>
    <script>
        let widgetContainer = document.getElementById('datacontent_widget');
        window['SemLookPWidgets'].createDataContent(
            {
                api: "https://www.ebi.ac.uk/ols4/api/",
            },
            widgetContainer
        );
    </script>
</body>

Run the project

To run the project, just run the index.html.

About

Example project illustrating the use of the SemLookP widgets in a plain JavaScript environment (non-React)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages