I wanted to try Faye in a Ionic 2 project but I don't understand how I am going to add it to the project. As explained here https://faye.jcoglan.com/download.html, I would, if 'require' was available, just do something like:
var faye = require('faye');
If I was serving this Javascript from my webserver, I would just include a Script tag, pointing to the client.js as following:
<script src='http://localhost:8000/faye/client.js'></script>
I tried this in Ionic 2
import { Faye } from 'faye';
//...
constructor(public navCtrl: NavController, platform: Platform, matchService: MatchService, faye : Faye) { //...
This code is generating this error:
Typescript error: Cannot find name 'Faye'
How do I do it with 'import' so I can use Faye Browser CLient in this project?
Generally you would look for type declarations in npm @types and you would install packages as
npm install @types/package_name.
But faye package doesnt seem to be added here.According to IONIC docs here
you have to include the declaration in declarations.d.ts file while adding pure javascript module to Ionic 2.