@tlestang wrote:
Hi all,
I am trying to use webgazer.js, a an eye-tracking library that comes as a single javascript file.Following a bit of research online, I added the script to the
src/assets/js/directory and added the webgazer.js file as a script in theindex.htmlof my app (within<head>):<script async src="./assets/js/webgazer.js" type="text/javascript"></script>I then created a page using
ionic g page test-eye-tracking-pageand used the
webgazerobject intest-eye-tracking-page.ts:export class TestEyeTrackingPage { constructor(public navCtrl: NavController, public navParams: NavParams) {} ionViewDidEnter() { //start the webgazer tracker webgazer.begin() }When visiting the eye tracking test page, I get the error
webgazer is undefinedAlternatively, I tried to use webgazer.js as a third party module, since the gitHub repo contains a
package.jsonfile.
Following the documentation, I added webgazer as a dependencynpm install github:brownhci/WebGazer --saveThere is now a
node_modules/webgazer/repository. I then built thewebgazer.jsfile and added it innodes_modules/webgazer/.Using the library in
test-eye-tracking-age.tsimport * as webgazer from 'webgazer'or
import 'webgazer'leads to
'webgazer is undefined'.Any advice on how to use the webgazer library ?
Posts: 1
Participants: 1