helper to apply bindings, wait, and check result
10629
function(bindingString, data, children, callback, containerless) {
            container = document.createElement("div");
            if (!containerless) {
                container.setAttribute("data-bind", bindingString);
                container.innerHTML = children || "";
            }
            else {
                var opening = document.createComment("ko " + bindingString),
                   closing = document.createComment("/ko"),
                    dummy = document.createTextNode("   \n  ");

                container.appendChild(opening);
                container.appendChild(dummy);
                container.appendChild(closing);
            }

            sandbox.appendChild(container);

            ko.cleanNode(sandbox);

            ko.applyBindings(data, sandbox);

            setTimeout(callback, 50);
        }
230270
public void waitForChecked(final long time) throws WidgetException {
        super.waitForCommand(new ITimerCallback() {

            @Override
            public boolean execute() {
                WebElement elem = null;
                try {
                    elem = getWebElement();
                } catch (WidgetException e) {

                }

                boolean isSelected = false;
                try {
                    isSelected = isSelected(elem);
                } catch (Exception e) {
                    throw new RuntimeException(e);
                }
                return (elem != null && isSelected);
            }

            @Override
            public String toString() {
                return "Waiting for element with the locator: " + getByLocator() + "to be checked";
            }
        }, time);
    }
726822
function waitfn () {
  const softTimeout = this.timeout || null
  const callback = this.callback
  let executionTimer
  let softTimeoutTimer
  let self = arguments[0]

  let args = sliced(arguments)
  let done = args[args.length - 1]

  let timeoutTimer = setTimeout(function () {
    clearTimeout(executionTimer)
    clearTimeout(softTimeoutTimer)
    done(new Error(`.wait() timed out after ${self.options.waitTimeout}msec`))
  }, self.options.waitTimeout)
  return tick.apply(this, arguments)

  function tick (self, fn) {
    if (softTimeout) {
      softTimeoutTimer = setTimeout(function () {
        clearTimeout(executionTimer)
        clearTimeout(timeoutTimer)
        done()
      }, softTimeout)
    }

    let waitDone = function (err, result) {
      if (callback) {
        result = callback(result)
      }
      if (result) {
        clearTimeout(timeoutTimer)
        clearTimeout(softTimeoutTimer)
        return done()
      } else if (err) {
        clearTimeout(timeoutTimer)
        clearTimeout(softTimeoutTimer)
        return done(err)
      } else {
        executionTimer = setTimeout(function () {
          tick.apply(self, args)
        }, self.options.pollInterval)
      }
    }
    let newArgs = [fn, waitDone].concat(args.slice(2, -1))
    self.evaluate_now.apply(self, newArgs)
  }
}
680723
async def wait_for_read_result(self):
        
        while not self.callback_data:
            await asyncio.sleep(.001)
        rval = self.callback_data
        self.callback_data = []
        return rval
600295
def _apply_callback(cls, callback, result):
        
        if not callback.immutable:
            callback.args = (result.id, ) + callback.args
        callback.apply()
252173
def wait_until(predicate, timeout=30):
    
    not_expired = Timeout(timeout)
    while not_expired():
        r = predicate()
        if r:
            break
937151
function() {
      this.handlers.push(topology.on('bindings-completed', () => {
        this.handle('bindings-completed');
      }));
      this.handlers.push(connection.on('reconnected', () => {
        this.transition('reconnecting');
      }));
      this.handlers.push(this.on('failed', (err) => {
        _.each(this.deferred, function(x) {
          x(err);
        });
        this.deferred = [];
      }));
    }
726727
function _processKey(event, bindings) {
			for (var id in bindings) {
				if (bindings[id] && bindings[id].keyBinding && bindings[id].command) {
					if (bindings[id].keyBinding.match(event)) {
						var activeBinding = bindings[id];
						var keyBinding = activeBinding.keyBinding;
						// Check for keys that are scoped to a particular part of the DOM
						if (!keyBinding.domScope || lib.contains(lib.node(keyBinding.domScope), event.target)) {
							if (executeBinding(activeBinding)) {
								lib.stop(event);
								return;
							}
						}
					}
				}
			}
		}
7496
public void waitInitOpen(String waitForSelector) {
        if (waitForSelector == null || waitForSelector.isEmpty()) {
            initDynamic();
            open();
            return;
        }
        waitInitOpen(waitForSelector, getElement());
    }
662117
def bind(cls, param=None, **kwargs):
        
        def stick(function, **binding):
            if not asyncio.iscoroutine(function):
                function = asyncio.coroutine(function)
            bindings = getattr(function, STICKER, [])
            bindings.append(binding)
            setattr(function, STICKER, bindings)
            return function
        if isinstance(param, str):
            return partial(stick, prefix=param, **kwargs)
        return stick(param, **kwargs)
775463
void notifyAcceptBind(Bind bindParameter) throws IllegalStateException {
        lock.lock();
        try {
            if (request == null) {
                request = new BindRequest(bindParameter, responseHandler);
                requestCondition.signal();
            } else {
                throw new IllegalStateException("Already waiting for acceptance bind");
            }
        } finally {
            lock.unlock();
        }
    }
963556
def wait_for(
        predicate,
        timeout_seconds=120,
        sleep_seconds=1,
        ignore_exceptions=True,
        inverse_predicate=False,
        noisy=False,
        required_consecutive_success_count=1):
    
    count = 0
    start_time = time_module.time()
    timeout = Deadline.create_deadline(timeout_seconds)
    while True:
        try:
            result = predicate()
        except Exception as e:
            if ignore_exceptions:
                if noisy:
                    logger.exception("Ignoring error during wait.")
            else:
                count = 0
                raise  # preserve original stack
        else:
            if (not inverse_predicate and result) or (inverse_predicate and not result):
                count = count + 1
            if count >= required_consecutive_success_count:
                return result

        if timeout.is_expired():
            funname = __stringify_predicate(predicate)
            raise TimeoutExpired(timeout_seconds, funname)
        if noisy:
            header = '{}[{}/{}]'.format(
                shakedown.cli.helpers.fchr('>>'),
                pretty_duration(time_module.time() - start_time),
                pretty_duration(timeout_seconds)
            )
            if required_consecutive_success_count > 1:
                header = '{} [{} of {} times]'.format(
                    header,
                    count,
                    required_consecutive_success_count)
            print('{} spinning...'.format(header))
        time_module.sleep(sleep_seconds)
505553
function tryCallback(callback, args) {
  try {
    return callback.apply(this, args);
  } catch (e) {
    if (typeof e === 'string') {
      return new binding.types.Error(e);
    } else if (e instanceof Error) {
      return new binding.types.Error(e.message);
    } else {
      return new binding.types.Error('An unexpected error occurred');
    }
  }
}
611899
def wait(button=LEFT, target_types=(UP, DOWN, DOUBLE)):
    
    from threading import Lock
    lock = Lock()
    lock.acquire()
    handler = on_button(lock.release, (), [button], target_types)
    lock.acquire()
    _listener.remove_handler(handler)
1284779
function handleResults(results) {
      // check if uniqueDisplayProperty is set
      // then filter the result to uniqueness
      if (self.uniqueDisplayProperty)
        results = handleUniqueResult(results);
      self.itemList = results;
      self.hidden = shouldHide();

      // If loading is in progress, then we'll end the progress. This is needed for example,
      // when the `clear` button was clicked, because there we always show the loading process, to prevent flashing.
      if (self.loading) setLoading(false);
    }
291821
def wait(self):
        
        self.thread.join()
        if self.error is not None:
            return self.error
        return self.result
227767
function bindOnReady(win, callback, eventUtils) {
      var doc = win.document, event = { type: 'ready' };

      if (eventUtils.domLoaded) {
        callback(event);
        return;
      }

      function isDocReady() {
        // Check complete or interactive state if there is a body
        // element on some iframes IE 8 will produce a null body
        return doc.readyState === "complete" || (doc.readyState === "interactive" && doc.body);
      }

      // Gets called when the DOM is ready
      function readyHandler() {
        if (!eventUtils.domLoaded) {
          eventUtils.domLoaded = true;
          callback(event);
        }
      }

      function waitForDomLoaded() {
        if (isDocReady()) {
          removeEvent(doc, "readystatechange", waitForDomLoaded);
          readyHandler();
        }
      }

      function tryScroll() {
        try {
          // If IE is used, use the trick by Diego Perini licensed under MIT by request to the author.
          // http://javascript.nwbox.com/IEContentLoaded/
          doc.documentElement.doScroll("left");
        } catch (ex) {
          Delay.setTimeout(tryScroll);
          return;
        }

        readyHandler();
      }

      // Use W3C method (exclude IE 9,10 - readyState "interactive" became valid only in IE 11)
      if (doc.addEventListener && !(Env.ie && Env.ie < 11)) {
        if (isDocReady()) {
          readyHandler();
        } else {
          addEvent(win, 'DOMContentLoaded', readyHandler);
        }
      } else {
        // Use IE method
        addEvent(doc, "readystatechange", waitForDomLoaded);

        // Wait until we can scroll, when we can the DOM is initialized
        if (doc.documentElement.doScroll && win.self === win.top) {
          tryScroll();
        }
      }

      // Fallback if any of the above methods should fail for some odd reason
      addEvent(win, 'load', readyHandler);
    }