lib/resource_waiter.js
function constructor(service, state) {
    this.service = service;
    this.state = state;

    if (typeof this.state === 'object') {
      AWS.util.each.call(this, this.state, function (key, value) {
        this.state = key;
        this.expectedValue = value;
      });
    }

    this.loadWaiterConfig(this.state);
    if (!this.expectedValue) {
      this.expectedValue = this.config.successValue;
    }
  }
function constructor(service, state) {
    this.service = service;
    this.state = state;

    if (typeof this.state === 'object') {
      AWS.util.each.call(this, this.state, function (key, value) {
        this.state = key;
        this.expectedValue = value;
      });
    }

    this.loadWaiterConfig(this.state);
    if (!this.expectedValue) {
      this.expectedValue = this.config.successValue;
    }
  }
Waits for a given state on a service object
@param service [Service] the service object to wait on
@param state [String] the state (defined in waiter configuration) to wait
for.
@example Create a waiter for running EC2 instances
var ec2 = new AWS.EC2;
var waiter = new AWS.ResourceWaiter(ec2, 'instanceRunning');