From 980fe00a74a9ad013b945755415ace2e5429c3c2 Mon Sep 17 00:00:00 2001 From: Alexey Pyltsyn Date: Wed, 27 Oct 2021 02:31:24 +0300 Subject: [RU] Remove notranslate (#2874) --- files/ru/web/api/setinterval/index.html | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'files/ru/web/api/setinterval/index.html') diff --git a/files/ru/web/api/setinterval/index.html b/files/ru/web/api/setinterval/index.html index 48763d06aa..7267237b16 100644 --- a/files/ru/web/api/setinterval/index.html +++ b/files/ru/web/api/setinterval/index.html @@ -10,7 +10,7 @@ original_slug: Web/API/WindowOrWorkerGlobalScope/setInterval

Синтаксис

-
var intervalID = scope.setInterval(func, delay[, param1, param2, ...]);
+
var intervalID = scope.setInterval(func, delay[, param1, param2, ...]);
 var intervalID = scope.setInterval(code, delay);
 
@@ -45,7 +45,7 @@ original_slug: Web/API/WindowOrWorkerGlobalScope/setInterval

The following example demonstrates setInterval()'s basic syntax.

-
var intervalID = window.setInterval(myCallback, 500);
+
var intervalID = window.setInterval(myCallback, 500);
 
 function myCallback() {
   // Your code here
@@ -56,7 +56,7 @@ function myCallback() {
 
 

В следующем примере вызывается функция flashtext() раз в секунду, до того момента, как будет нажата кнопка Stop.

-
<!DOCTYPE html>
+
<!DOCTYPE html>
 <html>
 <head>
   <meta charset="UTF-8" />
@@ -95,7 +95,7 @@ function myCallback() {
 
 

The following example simulates typewriter by first clearing and then slowly typing content into the NodeList that matches a specified group of selectors.

-
<!DOCTYPE html>
+
<!DOCTYPE html>
 <html>
 <head>
 <meta charset="UTF-8" />
@@ -258,7 +258,7 @@ Vivamus blandit massa ut metus mattis in fringilla lectus imperdiet. Proin ac an
 
 

As previously discussed, Internet Explorer versions 9 and below do not support the passing of arguments to the callback function in either setTimeout() or setInterval(). The following IE-specific code demonstrates a method for overcoming this limitation.  To use, simply add the following code to the top of your script.

-
/*\
+
/*\
 |*|
 |*|  IE-specific polyfill that enables the passage of arbitrary arguments to the
 |*|  callback functions of javascript timers (HTML5 standard syntax).
@@ -299,11 +299,11 @@ if (document.all && !window.setInterval.isPolyfill) {
 
 

Another possibility is to use an anonymous function to call your callback, although this solution is a bit more expensive. Example:

-
var intervalID = setInterval(function() { myFunc('one', 'two', 'three'); }, 1000);
+
var intervalID = setInterval(function() { myFunc('one', 'two', 'three'); }, 1000);

Another possibility is to use function's bind. Example:

-
var intervalID = setInterval(function(arg1) {}.bind(undefined, 10), 1000);
+
var intervalID = setInterval(function(arg1) {}.bind(undefined, 10), 1000);

{{h3_gecko_minversion("Inactive tabs", "5.0")}}

@@ -317,7 +317,7 @@ if (document.all && !window.setInterval.isPolyfill) {

Code executed by setInterval() runs in a separate execution context than the function from which it was called. As a consequence, the this keyword for the called function is set to the window (or global) object, it is not the same as the this value for the function that called setTimeout. See the following example (which uses setTimeout() instead of setInterval() – the problem, in fact, is the same for both timers):

-
myArray = ['zero', 'one', 'two'];
+
myArray = ['zero', 'one', 'two'];
 
 myArray.myMethod = function (sProperty) {
     alert(arguments.length > 0 ? this[sProperty] : this);
@@ -341,7 +341,7 @@ setTimeout.call(myArray, myArray.myMethod, 2500, 2); // same error
 
 

A possible way to solve the "this" problem is to replace the two native setTimeout() or setInterval() global functions with two non-native ones that enable their invocation through the Function.prototype.call method. The following example shows a possible replacement:

-
// Enable the passage of the 'this' object through the JavaScript timers
+
// Enable the passage of the 'this' object through the JavaScript timers
 
 var __nativeST__ = window.setTimeout, __nativeSI__ = window.setInterval;
 
@@ -363,7 +363,7 @@ window.setInterval = function (vCallback, nDelay /*, argumentToPass1, argumentTo
 
 

Новое тестируемое свойство:

-
myArray = ['zero', 'one', 'two'];
+
myArray = ['zero', 'one', 'two'];
 
 myArray.myMethod = function (sProperty) {
     alert(arguments.length > 0 ? this[sProperty] : this);
@@ -386,7 +386,7 @@ setTimeout.call(myArray, myArray.myMethod, 2500, 2); // prints "two" after 2,5 s
 
 

minidaemon.js

-
/*\
+
/*\
 |*|
 |*|  :: MiniDaemon ::
 |*|
@@ -516,7 +516,7 @@ MiniDaemon.prototype.start = function (bReverse) {
 
 

Ваша HTML страница:

-
<!DOCTYPE html>
+
<!DOCTYPE html>
 <html>
 <head>
   <meta charset="UTF-8" />
@@ -567,7 +567,7 @@ MiniDaemon.prototype.start = function (bReverse) {
 
 

In these cases, a recursive setTimeout() pattern is preferred:

-
(function loop(){
+
(function loop(){
    setTimeout(function() {
       // Your logic here
 
-- 
cgit v1.2.3-54-g00ecf