nativescript
सार्वत्रिक चर
खोज…
कंसोल
नेटिवस्क्रिप्ट का ग्लोबल console वैरिएबल आपको डिबगिंग के लिए अपने टर्मिनल पर मान प्रिंट करने देता है। सबसे सरल उपयोग console.log() फ़ंक्शन के लिए एक मान गुजर रहा है:
console.log("hello world");
console वस्तु सहित कई अन्य तरीकों, है dump() , trace() , assert() और अधिक ।
// Prints the state of a full object.
console.dump({ firstName: "Native", lastName: "Script"});
// Prints the current stack trace
console.trace();
// Asserts a boolean condition, and prints to the console if the assertion fails.
console.assert(1 === 1, "This won’t print as the condition is true");
console.assert(1 === 2, "This will print as the condition is false");
टाइमर (जावास्क्रिप्ट)
नेटिवस्क्रिप्ट का वैश्विक timer चर आपको अतुल्यकालिक विलंबित फ़ंक्शन कॉल के लिए टाइमआउट और अंतराल सेट करने देता है।
आयात कर रहा है
var timer = require("timer")
समय समाप्ति
var callback = function(){
console.log("I will be executed once after 500ms");
}
var timeoutId = timer.setTimeout(callback, 500);
// clearing the timeout
timer.clearTimeout(timeoutId);
अंतराल
var callback = function(){
console.log("I will be executed every 500 ms")
}
var intervalId = timer.setInterval(callback, 500);
// clearing the interval
timer.clearInterval(intervalId);
Modified text is an extract of the original Stack Overflow Documentation
के तहत लाइसेंस प्राप्त है CC BY-SA 3.0
से संबद्ध नहीं है Stack Overflow