PeterStaev / nativescript-azure-mobile-apps

:cloud: NativeScript plugin for working with Microsoft Azure Mobile Apps services
Apache License 2.0
30 stars 10 forks source link

JavaScript support #20

Closed emmanuel128 closed 7 years ago

emmanuel128 commented 7 years ago

I see that the documentation is written in TypeScript

import { MobileServiceClient } from "nativescript-azure-mobile-apps/client";
var client = new MobileServiceClient("https://**********.azurewebsites.net");

I'm trying to use this plugin with JavaScript writing the code above like this:

var MobileServiceClient  = require("nativescript-azure-mobile-apps/client");
var client = new MobileServiceClient("https://**********.azurewebsites.net");

but I get MobileServiceClient  is not a constructor.

I would like to know if the plugin works with JavaScript and how I'm supposed to write it.

PeterStaev commented 7 years ago

Hey @emmanuel128 , any NativeScript plugin supports both TS and JS, becuase TS transpiles to JS. If you want to see the JS you can open the demo in the repo, run it and then see in the respective folders the created JS files. For your specific example it should be:

var MobileServiceClient  = require("nativescript-azure-mobile-apps/client").MobileServiceClient;
var client = new MobileServiceClient("https://**********.azurewebsites.net");
emmanuel128 commented 7 years ago

Thank you, it worked!