Where to write application specific code?


#1

I am not sure if this is the right to post this question. if you find it inappropriate for this forum feel free to delete this question but let me know where should I ask this.

I am using Nathan walker’s angular2-seed and I have used a nativescript-dropdown-list plugin for the mobile application and my requirement is that I don’t want to have dropdown-list in my web application.

now my question is where should I write the component code for web and mobile? because if I try to build the web application then it will give me nativescript-drownpdown-list not found error, because I added that module dependency in nativescript folder and not in web application modules.
Could anyone please help me how should I proceed further with this requirement?

Note: I don’t want to mix nativescript modules with the web application modules.


#2

hi, you’re going to want to use a system of Opaque Tokens to support this use case, which essentially allows you to protect your web code from your mobile code. You can dig into https://github.com/jlooper/pocketrave for a somewhat old example. Look for tokens.web.ts and tokens.native.ts and see how you handle NativeScript-specific plugins with this example.