Unable to access object which passed in custom event listner


#1

Hi,

I’m unable to access object which is bound with custom event. For Example

import { Component } from '@angular/core';
import { Platform } from 'ionic-angular';
import { StatusBar, Splashscreen } from 'ionic-native';

import { HomePage } from '../pages/home/home';
import { LoginPage} from '../pages/login/login';
import { Auth } from '../providers/auth';
import { Geofence } from 'ionic-native';

import { LoadingController } from 'ionic-angular';

declare var Gimbal2:any;

@Component({
  templateUrl: 'app.html'
})

export class MyApp {

  rootPage: any = LoginPage;
  loader: any;

  constructor(public auth: Auth, public loadingCtrl: LoadingController, platform: Platform) {
    platform.ready().then(() => {
    // Okay, so the platform is ready and our plugins are available.
    // Here you can do any higher level native things you might need.
    StatusBar.styleDefault();
    Splashscreen.hide();
    window.addEventListener('beaconsighting', function(sighting) {
     alert('Found Gimbal: ' + sighting.RSSI);
  });
}

Then it says.

[ts] Property ‘RSSI’ does not exist on type ‘Event’.
any

I got sightings as object but can’t compile with object attribute like listed below.

there are seven object associate with event but none of them accessible.

RSSI: Signal strength of the sighting
datetime: Time when the sighting occured
beaconName
beaconIdentifier
beaconBatteryLevel
beaconIconUrl
beaconTemperature

I even don’t know proper way to register/add custom event listeners in Typescript or IONIC2. if you just give me ref. to look up for proper custom event listeners then it would be great.

Please advise.

-Naitik J