How do I import and use module using core JS in NativeScriptHow to validate an email address in JavaScriptHow do JavaScript closures work?How do I check if an element is hidden in jQuery?How do I remove a property from a JavaScript object?How do I redirect to another webpage?How do I include a JavaScript file in another JavaScript file?How to replace all occurrences of a string?How to check whether a string contains a substring in JavaScript?How do I remove a particular element from an array in JavaScript?How do I return the response from an asynchronous call?

Could a simple hospital oxygen mask protect from aerosol poison?

Create a list of snaking numbers under 50,000

How to number subfigures in Serbian Cyrillic?

Large intervals in score in Bach

Padding a column of lists

Cheap oscilloscope showing 16 MHz square wave

Quick Tilepaint Puzzles: Corridors and Corners

What is the practical impact of using System.Random which is not cryptographically random?

When you have to wait for a short time

Does the telecom provider need physical access to the SIM card to clone it?

An idiom for “Until you punish the offender, they will not give up offenses”

Calculate Landau's function

How could reincarnation magic be limited to prevent overuse?

Can two aircraft be allowed to stay on the same runway at the same time?

Can I leave a large suitcase at TPE during a 4-hour layover, and pick it up 4.5 days later when I come back to TPE on my way to Taipei downtown?

Existing light fixture is connected to 2 white wires, black wires are capped

A word for the urge to do the opposite

How to save money by shopping at a variety of grocery stores?

Is this statement about a motion being simple harmonic in nature strong?

Heavy Box Stacking

How does Hand of the Apprentice interact with rogue abilities?

'spazieren' - walking in a silly and affected manner?

Should a TA point out a professor's mistake while attending their lecture?

What's the origin of the concept of alternate dimensions/realities?



How do I import and use module using core JS in NativeScript


How to validate an email address in JavaScriptHow do JavaScript closures work?How do I check if an element is hidden in jQuery?How do I remove a property from a JavaScript object?How do I redirect to another webpage?How do I include a JavaScript file in another JavaScript file?How to replace all occurrences of a string?How to check whether a string contains a substring in JavaScript?How do I remove a particular element from an array in JavaScript?How do I return the response from an asynchronous call?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















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.










share|improve this question
























  • github.com/NathanWalker/nativescript-fancyalert/issues/24

    – Narendra
    Mar 28 at 2:42

















0















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.










share|improve this question
























  • github.com/NathanWalker/nativescript-fancyalert/issues/24

    – Narendra
    Mar 28 at 2:42













0












0








0








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.










share|improve this question














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.







javascript nativescript node-modules






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 28 at 0:13









John S.John S.

2107 bronze badges




2107 bronze badges















  • github.com/NathanWalker/nativescript-fancyalert/issues/24

    – Narendra
    Mar 28 at 2:42

















  • github.com/NathanWalker/nativescript-fancyalert/issues/24

    – Narendra
    Mar 28 at 2:42
















github.com/NathanWalker/nativescript-fancyalert/issues/24

– Narendra
Mar 28 at 2:42





github.com/NathanWalker/nativescript-fancyalert/issues/24

– Narendra
Mar 28 at 2:42












1 Answer
1






active

oldest

votes


















1















Try: fancyAlert.TNSFancyAlert.showSuccess().



[EDIT] This really should work, as it's a mirror of the solution given in the issue filing linked by Narendra Mongiya in your question. One thing to keep in mind is that it's a Promise, so let's add a catch() block in there to reveal any errors.



const fancyAlert = require("nativescript-fancyalert");

// ...

fancyAlert.TNSFancyAlert.showSuccess(
"Success!",
"You are logged in.",
"Success!"
)
.then((resolution) =>
console.log("[TNSFancyAlert] showSuccess() succeeded.", resolution);
)
.catch((error) =>
console.error("[TNSFancyAlert] showSuccess() failed.", error);
);


You may also find that you're simply calling it from the wrong place in your code.






share|improve this answer



























  • I just tried. Still not working, unfortunately.

    – John S.
    Mar 28 at 0:48











  • @JohnS. I've edited for clarification; how about now?

    – Jamie Birch
    Mar 28 at 9:38











  • @JohnS. I notice that in your JS example, the context of the fancy alert call is unclear; you are wrapping that inside a showSuccess function, right? Bear in mind that you have to bind showSuccess properly between the XML and the JS file in order for it to work. See the Data Binding documentation for more examples (in both TypeScript and JavaScript). You can also refer to TypeScript Playground to convert any TS snippets you find elsewhere to JS.

    – Jamie Birch
    Mar 28 at 9:44












  • first , thanks so much for taking your time to try to help me. Now, this is weird.... I used your code, and the app runs, but no alert, and no error either. Here it is on the PlayGround: play.nativescript.org/?template=play-js&id=vCLv25&v=2 Do you see where I am going wrong here??

    – John S.
    Mar 28 at 17:17






  • 1





    Your playground is showing error, ERROR: [TNSFancyAlert] showSuccess() failed. ReferenceError: Can't find variable: SCLAlertView

    – Narendra
    Mar 28 at 22:12










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55388351%2fhow-do-i-import-and-use-module-using-core-js-in-nativescript%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1















Try: fancyAlert.TNSFancyAlert.showSuccess().



[EDIT] This really should work, as it's a mirror of the solution given in the issue filing linked by Narendra Mongiya in your question. One thing to keep in mind is that it's a Promise, so let's add a catch() block in there to reveal any errors.



const fancyAlert = require("nativescript-fancyalert");

// ...

fancyAlert.TNSFancyAlert.showSuccess(
"Success!",
"You are logged in.",
"Success!"
)
.then((resolution) =>
console.log("[TNSFancyAlert] showSuccess() succeeded.", resolution);
)
.catch((error) =>
console.error("[TNSFancyAlert] showSuccess() failed.", error);
);


You may also find that you're simply calling it from the wrong place in your code.






share|improve this answer



























  • I just tried. Still not working, unfortunately.

    – John S.
    Mar 28 at 0:48











  • @JohnS. I've edited for clarification; how about now?

    – Jamie Birch
    Mar 28 at 9:38











  • @JohnS. I notice that in your JS example, the context of the fancy alert call is unclear; you are wrapping that inside a showSuccess function, right? Bear in mind that you have to bind showSuccess properly between the XML and the JS file in order for it to work. See the Data Binding documentation for more examples (in both TypeScript and JavaScript). You can also refer to TypeScript Playground to convert any TS snippets you find elsewhere to JS.

    – Jamie Birch
    Mar 28 at 9:44












  • first , thanks so much for taking your time to try to help me. Now, this is weird.... I used your code, and the app runs, but no alert, and no error either. Here it is on the PlayGround: play.nativescript.org/?template=play-js&id=vCLv25&v=2 Do you see where I am going wrong here??

    – John S.
    Mar 28 at 17:17






  • 1





    Your playground is showing error, ERROR: [TNSFancyAlert] showSuccess() failed. ReferenceError: Can't find variable: SCLAlertView

    – Narendra
    Mar 28 at 22:12















1















Try: fancyAlert.TNSFancyAlert.showSuccess().



[EDIT] This really should work, as it's a mirror of the solution given in the issue filing linked by Narendra Mongiya in your question. One thing to keep in mind is that it's a Promise, so let's add a catch() block in there to reveal any errors.



const fancyAlert = require("nativescript-fancyalert");

// ...

fancyAlert.TNSFancyAlert.showSuccess(
"Success!",
"You are logged in.",
"Success!"
)
.then((resolution) =>
console.log("[TNSFancyAlert] showSuccess() succeeded.", resolution);
)
.catch((error) =>
console.error("[TNSFancyAlert] showSuccess() failed.", error);
);


You may also find that you're simply calling it from the wrong place in your code.






share|improve this answer



























  • I just tried. Still not working, unfortunately.

    – John S.
    Mar 28 at 0:48











  • @JohnS. I've edited for clarification; how about now?

    – Jamie Birch
    Mar 28 at 9:38











  • @JohnS. I notice that in your JS example, the context of the fancy alert call is unclear; you are wrapping that inside a showSuccess function, right? Bear in mind that you have to bind showSuccess properly between the XML and the JS file in order for it to work. See the Data Binding documentation for more examples (in both TypeScript and JavaScript). You can also refer to TypeScript Playground to convert any TS snippets you find elsewhere to JS.

    – Jamie Birch
    Mar 28 at 9:44












  • first , thanks so much for taking your time to try to help me. Now, this is weird.... I used your code, and the app runs, but no alert, and no error either. Here it is on the PlayGround: play.nativescript.org/?template=play-js&id=vCLv25&v=2 Do you see where I am going wrong here??

    – John S.
    Mar 28 at 17:17






  • 1





    Your playground is showing error, ERROR: [TNSFancyAlert] showSuccess() failed. ReferenceError: Can't find variable: SCLAlertView

    – Narendra
    Mar 28 at 22:12













1














1










1









Try: fancyAlert.TNSFancyAlert.showSuccess().



[EDIT] This really should work, as it's a mirror of the solution given in the issue filing linked by Narendra Mongiya in your question. One thing to keep in mind is that it's a Promise, so let's add a catch() block in there to reveal any errors.



const fancyAlert = require("nativescript-fancyalert");

// ...

fancyAlert.TNSFancyAlert.showSuccess(
"Success!",
"You are logged in.",
"Success!"
)
.then((resolution) =>
console.log("[TNSFancyAlert] showSuccess() succeeded.", resolution);
)
.catch((error) =>
console.error("[TNSFancyAlert] showSuccess() failed.", error);
);


You may also find that you're simply calling it from the wrong place in your code.






share|improve this answer















Try: fancyAlert.TNSFancyAlert.showSuccess().



[EDIT] This really should work, as it's a mirror of the solution given in the issue filing linked by Narendra Mongiya in your question. One thing to keep in mind is that it's a Promise, so let's add a catch() block in there to reveal any errors.



const fancyAlert = require("nativescript-fancyalert");

// ...

fancyAlert.TNSFancyAlert.showSuccess(
"Success!",
"You are logged in.",
"Success!"
)
.then((resolution) =>
console.log("[TNSFancyAlert] showSuccess() succeeded.", resolution);
)
.catch((error) =>
console.error("[TNSFancyAlert] showSuccess() failed.", error);
);


You may also find that you're simply calling it from the wrong place in your code.







share|improve this answer














share|improve this answer



share|improve this answer








edited Mar 28 at 9:38

























answered Mar 28 at 0:28









Jamie BirchJamie Birch

2,36019 silver badges37 bronze badges




2,36019 silver badges37 bronze badges















  • I just tried. Still not working, unfortunately.

    – John S.
    Mar 28 at 0:48











  • @JohnS. I've edited for clarification; how about now?

    – Jamie Birch
    Mar 28 at 9:38











  • @JohnS. I notice that in your JS example, the context of the fancy alert call is unclear; you are wrapping that inside a showSuccess function, right? Bear in mind that you have to bind showSuccess properly between the XML and the JS file in order for it to work. See the Data Binding documentation for more examples (in both TypeScript and JavaScript). You can also refer to TypeScript Playground to convert any TS snippets you find elsewhere to JS.

    – Jamie Birch
    Mar 28 at 9:44












  • first , thanks so much for taking your time to try to help me. Now, this is weird.... I used your code, and the app runs, but no alert, and no error either. Here it is on the PlayGround: play.nativescript.org/?template=play-js&id=vCLv25&v=2 Do you see where I am going wrong here??

    – John S.
    Mar 28 at 17:17






  • 1





    Your playground is showing error, ERROR: [TNSFancyAlert] showSuccess() failed. ReferenceError: Can't find variable: SCLAlertView

    – Narendra
    Mar 28 at 22:12

















  • I just tried. Still not working, unfortunately.

    – John S.
    Mar 28 at 0:48











  • @JohnS. I've edited for clarification; how about now?

    – Jamie Birch
    Mar 28 at 9:38











  • @JohnS. I notice that in your JS example, the context of the fancy alert call is unclear; you are wrapping that inside a showSuccess function, right? Bear in mind that you have to bind showSuccess properly between the XML and the JS file in order for it to work. See the Data Binding documentation for more examples (in both TypeScript and JavaScript). You can also refer to TypeScript Playground to convert any TS snippets you find elsewhere to JS.

    – Jamie Birch
    Mar 28 at 9:44












  • first , thanks so much for taking your time to try to help me. Now, this is weird.... I used your code, and the app runs, but no alert, and no error either. Here it is on the PlayGround: play.nativescript.org/?template=play-js&id=vCLv25&v=2 Do you see where I am going wrong here??

    – John S.
    Mar 28 at 17:17






  • 1





    Your playground is showing error, ERROR: [TNSFancyAlert] showSuccess() failed. ReferenceError: Can't find variable: SCLAlertView

    – Narendra
    Mar 28 at 22:12
















I just tried. Still not working, unfortunately.

– John S.
Mar 28 at 0:48





I just tried. Still not working, unfortunately.

– John S.
Mar 28 at 0:48













@JohnS. I've edited for clarification; how about now?

– Jamie Birch
Mar 28 at 9:38





@JohnS. I've edited for clarification; how about now?

– Jamie Birch
Mar 28 at 9:38













@JohnS. I notice that in your JS example, the context of the fancy alert call is unclear; you are wrapping that inside a showSuccess function, right? Bear in mind that you have to bind showSuccess properly between the XML and the JS file in order for it to work. See the Data Binding documentation for more examples (in both TypeScript and JavaScript). You can also refer to TypeScript Playground to convert any TS snippets you find elsewhere to JS.

– Jamie Birch
Mar 28 at 9:44






@JohnS. I notice that in your JS example, the context of the fancy alert call is unclear; you are wrapping that inside a showSuccess function, right? Bear in mind that you have to bind showSuccess properly between the XML and the JS file in order for it to work. See the Data Binding documentation for more examples (in both TypeScript and JavaScript). You can also refer to TypeScript Playground to convert any TS snippets you find elsewhere to JS.

– Jamie Birch
Mar 28 at 9:44














first , thanks so much for taking your time to try to help me. Now, this is weird.... I used your code, and the app runs, but no alert, and no error either. Here it is on the PlayGround: play.nativescript.org/?template=play-js&id=vCLv25&v=2 Do you see where I am going wrong here??

– John S.
Mar 28 at 17:17





first , thanks so much for taking your time to try to help me. Now, this is weird.... I used your code, and the app runs, but no alert, and no error either. Here it is on the PlayGround: play.nativescript.org/?template=play-js&id=vCLv25&v=2 Do you see where I am going wrong here??

– John S.
Mar 28 at 17:17




1




1





Your playground is showing error, ERROR: [TNSFancyAlert] showSuccess() failed. ReferenceError: Can't find variable: SCLAlertView

– Narendra
Mar 28 at 22:12





Your playground is showing error, ERROR: [TNSFancyAlert] showSuccess() failed. ReferenceError: Can't find variable: SCLAlertView

– Narendra
Mar 28 at 22:12






Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55388351%2fhow-do-i-import-and-use-module-using-core-js-in-nativescript%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현