jeudi 27 juin 2019

Implement xApi technologie in an Angular project

Currently working with the xApi technologie, i’m facing some issues.

In fact, I want to use xApi in an Angular project, in order to follow every the actions of a user on a website (Account creation, delete …).

My problem, is that i couldn’t find any way to implement the xApi functions in my Angular project, using the npm xapiwrapper to get every xApi js functions i need to use.

I tried the usal way to implement js files in Angular, aswell i tried to follow tutorials on how to implement JS in Angular 6/7, but still i don’t why nothing is working so far.

There is the xapiWrapper file, which contains every js functions i need to use in order to send datas to the LRS, and I have a custom js file which use the wrapper functions and the mail + name of the user I need to "follow".

I already tried to call my js files in the usual way with the html, with the angular json file. I also followed the tutorials on how to implement js files in Angular, but still nothing actually works ...

            xApi function i need to use : 
    function sendStarted(){
        var startedStatement = {  
            "actor": {  
            "mbox": "mailto:"+email,  
            "name": name,  
            "objectType": "Agent"  
           },  

       "verb": {  
       "id": "https://w3id.org/xapi/dod-isd/verbs/started",  
       "display": {"en-US": "started"}  
       },  

       "object": {  
       "id": "http://learningdojo.net/xapi/simple_button",  
       "definition": {  
       "name": {"en-US": "Simple button started"},  
       "description": {"en-US": "User clicked on the started button."}  
      },  
       "objectType": "Activity"  
    }  
    };

    ADL.XAPIWrapper.sendStatement(startedStatement); 

    // Alert message
    alert('Started statement has been sent!')
    }


 The LRS configuration is in the xApiwrapper.js file. 

So here is my question : Is it possible to use or implement in any way the external xApi js files (xapiWrapper, xapi verbs, statement …) in my Angular Project, in oder to use it in my app component.

Thanks for your time and your answers.




Aucun commentaire:

Enregistrer un commentaire