Node.js 要识别的环境变量是否部署在移动应用程序或Web应用程序上?
嗨,我使用离子5与角。我有一个移动应用程序,我目前正在开发一个Web应用程序,它使用与移动应用程序相同的代码库 我正在寻找一种方法来配置一些环境变量,以识别应用程序是部署在移动应用程序还是Web应用程序上。谢谢:)Node.js 要识别的环境变量是否部署在移动应用程序或Web应用程序上?,node.js,angularjs,ionic-framework,ionic5,Node.js,Angularjs,Ionic Framework,Ionic5,嗨,我使用离子5与角。我有一个移动应用程序,我目前正在开发一个Web应用程序,它使用与移动应用程序相同的代码库 我正在寻找一种方法来配置一些环境变量,以识别应用程序是部署在移动应用程序还是Web应用程序上。谢谢:) import {Platform } from '@ionic/angular'; @Component({ templateUrl: 'app.html' }) export class MyApp { rootPage = HomePage; construc
import {Platform } from '@ionic/angular';
@Component({
templateUrl: 'app.html'
})
export class MyApp {
rootPage = HomePage;
constructor(platform: Platform) {
platform.ready().then(() => {
if (this.platform.is('android')) {
console.log("running on Android device!");
}
if (this.platform.is('ios')) {
console.log("running on iOS device!");
}
if (this.platform.is('mobileweb')) {
console.log("running in a browser on mobile!");
}
});
}
}