Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion component.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"version": "0.0.1",
"keywords": [],
"dependencies": {
"fs-components/qwery": "*"
"component/query": "*",
"jamischarles/query-qwery": "*"
},
"development": {},
"license": "MIT",
Expand Down
22 changes: 11 additions & 11 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
* Module dependencies
*
*/
var qwery = require('qwery');
require('query-qwery'); //query fallback for old browsers
var query = require('query');

//first 2 params are required
module.exports = function(query, success, failure, cfg){
module.exports = function(query_str, success, failure, cfg){
cfg = cfg || {};
failure = failure || function(){};

Expand All @@ -30,30 +31,30 @@ module.exports = function(query, success, failure, cfg){
}
};

debugLog('query: ' + query);
debugLog('query: ' + query_str);

//set timeout



var isElFound = function(el_query){
return qwery(el_query);
return query.all(el_query);
}

var abortPolling = function(){
//cancel poll timer
debugLog(query + ' el not found. Aborting.')
debugLog(query_str + ' el not found. Aborting.')
clearTimeout(poll_timer);
failure(query);
failure(query_str);
}

var pollDom = function(){
debugLog('polling for ' + query);
var el_array = isElFound(query);
debugLog('polling for ' + query_str);
var el_array = isElFound(query_str);

//if yes, pass nodes to success
if (el_array.length !== 0){
debugLog(query + " found");
debugLog(query_str + " found");
//cancel timeout timer
clearTimeout(failure_timer);

Expand All @@ -70,5 +71,4 @@ module.exports = function(query, success, failure, cfg){

pollDom();

}

};