/** * Wait until the test condition is true or a timeout occurs. Useful for waiting * on a server response or for a ui change (fadeIn, etc.) to occur. * * @param testFx javascript condition that evaluates to a boolean, * it can be passed in as a string (e.g.: “1 == 1” or … Read More “PHANTOMJS: ADDING TIMEOUT FOR WAITING RESPONSES” »
Tag: javascript
A sample of creating a get request using nodejs on https let https = request(‘https’); const options = { hostname: ‘www.panda.tv’, path: ‘ajax_chatinfo?roomid=89757’, headers: { ‘User-Agent’: ‘Mozilla/5.0’ } }; console.log(‘generated options’ + options); const req = https.get(options, (res) => { let body = ”; console.log(‘Status:’, res.statusCode); console.log(‘Headers:’, JSON.stringify(res.headers)); res.setEncoding(‘utf8’); res.on(‘data’, (chunk) => body += chunk); … Read More “NODEJS: HTTPS – QUICKSAMPLE” »
//** * Function that recieves a array and the rule to filter the itens on it * One sample: * function reduceToArray([],item=>item.id==1); * * Rule is to be a function that will have a item of the array as the parameter and his result is a boolean * like this for example: * function rule(item){ … Read More “JAVASCRIPT: ARRAYS – REDUCING TO AN ARRAY” »