resource_waiter.js (600B)
1 var util = require('../util'); 2 var property = util.property; 3 4 function ResourceWaiter(name, waiter, options) { 5 options = options || {}; 6 property(this, 'name', name); 7 property(this, 'api', options.api, false); 8 9 if (waiter.operation) { 10 property(this, 'operation', util.string.lowerFirst(waiter.operation)); 11 } 12 13 var self = this; 14 var keys = [ 15 'type', 16 'description', 17 'delay', 18 'maxAttempts', 19 'acceptors' 20 ]; 21 22 keys.forEach(function(key) { 23 var value = waiter[key]; 24 if (value) { 25 property(self, key, value); 26 } 27 }); 28 } 29 30 module.exports = ResourceWaiter;