1.0.0 • Published 3 years ago

jsontoquiz v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

JsonToQuiz

Screenshot

WebComponent that converts json data to Quiz with user-friendly ui

Getting Started

Prerequisites

  • install npm package
npm install npm@latest -g

Usage

json data format:

    [
    {
        "title": "Who said :Hey, Im Chandler, could I BE wearing any more clothes?",
        "answers": [
            {
                "title": "Joey"
            },
            {
                "title": "Chandler"
            }
        ]
    },
    {
        "title": "What name did Ross accidentally say at the alter?",
        "answers": [
            {
                "title": "Phoebe"
            },
            {
                "title": "Rachel"
            },
            {
                "title": "Chandler"
            }
        ]
    },
    {
        "title": "Whos catch phrase is 'How you doin?'",
        "answers": [
            {
                "title": "Phoebe"
            },
            {
                "title": "Joey"
            }
        ]
    }
]

Add WebComponent to html

    <quiz-component data='[
        {
            "title": "Who said :Hey, Im Chandler, could I BE wearing any more clothes?",
            "answers": [
                {
                    "title": "Joey"
                },
                {
                    "title": "Chandler"
                }
            ]
        }, ...
    ]'> 
    </quiz-component>    

you can access results after finishing quiz:

    var quiz= this.document.querySelector(".quiz");
    quiz.results();