You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2019/01/25 13:54:32 UTC
[GitHub] MrWeezle opened a new issue #83: Object(...) is not a function
MrWeezle opened a new issue #83: Object(...) is not a function
URL: https://github.com/apache/cordova-plugin-network-information/issues/83
Hello,
i am tring to integrate a network check to my ionic app, so I can do work when the device has internet connection. The problem that I have is, that the app (browser and android) crashes with the following error:
> logger.ts:67 TypeError: Object(...) is not a function
at Network.onConnect (index.js:62)
at MyApp.webpackJsonp.820.MyApp.manageNetworkConnection (app.component.ts:251)
at app.component.ts:205
at t.invoke (polyfills.js:3)
at Object.onInvoke (core.js:4760)
at t.invoke (polyfills.js:3)
at r.run (polyfills.js:3)
at polyfills.js:3
at t.invokeTask (polyfills.js:3)
at Object.onInvokeTask (core.js:4751)
My code is as follows:
import { Network } from '@ionic-native/network/ngx';
constructor(private network: Network) {
this.platform.ready().then(() => {
this.manageNetworkConnection();
}
}
manageNetworkConnection() {
//Watch for a connection
let connectSubscription = this.network.onConnect().subscribe(() => {
console.log('network connected!');
setTimeout(() => {
console.log('we got a connection, woohoo!');
}, 3000);
});
//Watch for disconnecting a network
let disconnectSubscription = this.network.onDisconnect().subscribe(() => {
console.log('network was disconnected');
});
}
I have to use the "ngx"-part for the import, otherwise it tells me, it "Cannot find name 'Network'".
Does somebody know, how I can fix that problem? I couldn't find anything related to this.
Thanks in advance
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org