Problem: Using NPM Modules From NativeScript using Core Javascript
I am new to NativeScript and am trying to use the FancyAlert NPM module:
https://github.com/NathanWalker/nativescript-fancyalert
In their readme, they show a very simple example using TypeScript, like this:
import { TNSFancyAlert, TNSFancyAlertButton } from "nativescript-fancyalert";
.
.
.
public showSuccess() {
TNSFancyAlert.showSuccess(
"Success!",
"Fancy alerts are nice.",
"Yes they are!"
);
}
and in their XML file, they simply call it like normal:
<Button text="Alert Success" tap="{{showSuccess}}" />
How to convert that to core JS
So I am not using TypeScript. I cannot get this simple alert to work. I have tried:
in my main-view-model.js
const fancyAlert = require("nativescript-fancyalert");
.
.
.
fancyAlert.showSuccess(
"Success!",
"You are logged in.",
"Success!"
);
not working.
Can anyone help me to use this module using core JS?
Thank you.