Guest User

Untitled

a guest
Jun 19th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. export class Grid {
  2. constructor(...drivers) {
  3. this._drivers = drivers || [];
  4. }
  5.  
  6. addDriver(driver) {
  7. this._drivers.push(driver);
  8. }
  9.  
  10. [Symbol.iterator]() {
  11. this._index = 0;
  12.  
  13. return {
  14. next: () => {
  15. if (this._index == this._drivers.length) {
  16. return { done: true };
  17. }
  18.  
  19. return {
  20. value: this._drivers[this._index++],
  21. done: false
  22. }
  23. }
  24. }
  25. }
  26. }
Add Comment
Please, Sign In to add comment