import { fromEvent, EMPTY, interval, merge, timer } from 'rxjs';
import { scan, startWith, switchMap, mapTo, delay } from 'rxjs/operators';
const DELAY=1000;
const button = document.createElement('button');
button.textContent = 'Click me';
document.documentElement.appendChild(button);
const click$ = fromEvent(button, 'click').pipe(
mapTo(false),
)
const unclick$ = click$.pipe(
delay(DELAY),
mapTo(true),
)
merge(click$, unclick$).pipe(
startWith(true),
switchMap(event => event ? timer(0, 1000) : EMPTY),
scan(acc => acc + 1, 0),
)
станавливатьна 300мсозначает "делать паузу"
string str = Request.Content.ReadAsStringAsync().GetAwaiter().GetResult();
[HttpPost]
[Route("some/my/route")]
public string TestMethod(SomeClassModel model)
{
return "Hello from http post web api controller: " + model.Value;
}
public class SomeClassModel
{
public string Value { get; set; }
}
2. Не нужно использовать повторно
var data = {
"SiteInfo": {
"SiteURL": "devsite",
"WebName": ""
},
"TaxonomyGuid": "d3eaa59d-f18f-40ae-8b74-57233738d4e2",
"TermStoreName": "Managed Metadata Service Application"
}
$.ajax({
url: site,
type: "POST",
headers: {
"Accept": "application/json; odata=verbose"
},
data: JSON.stringify(data),
processData: false,
.....
})
public int SumStrings(params string[] numbers)
{
return numbers.Sum(numberString => Convert.ToInt32(numberString));
}
Score = SumStrings(Q1, Q2, Q3, Q4, Q5, Q6, Q7);
$('img[src="/_layouts/15/images/rbsel.gif"]');
$('img[src*="rbsel.gif"]');
// Вариант 1
var img = $("img[src*='rbsel.gif']");
if(img.length > 0) {
console.log(img);
}
// Вариант 2
var img2 = $("img[alt='Selected']");
if(img2.length > 0) {
console.log(img2);
}
<div class="container">
<div id="inputText">
<button class="btn btn-info">Start Travel</button>
<input class="form-control">
<input class="form-control">
<input class="form-control">
<button onclick="f1()" class="btn btn-info">Add Traveler</button>
</div>
<div id="out">
</div>
</div>
function f1(){
var out = document.getElementById('out');
var clonningEl = document.querySelector('#inputText').cloneNode(true);
out.appendChild(clonningEl);
}