1.0.0
Admits a finite number of people into the event hall. Once in, they are ushered in pairs by the first available usher
(Number)
number of people to admit into
the event hall at this point in time
Promise
:
When trying to admit people into the hall, this helps us keep track of the seating capacity as well as total number admitted so far. We only attempt to admit 16 at a time or just the number needed to no exceed the seating capacity
Number
:
Determines the next valid number of people to admit into the hall
Number
:
Relies on personsToEnter
to recursively admit only the next valid
number of people into the event hall
Promise
:
Simulates arranging the seating space. We actually only create the 500 row nodes, and delay creating the seat nodes until an attendee needs to be seated. This helps ensure we don't start the app with 8k seat nodes in the DOM
Each side has 250 rows and both contain a row-0 (the first row) and up to a row-249 (the last row)
Promise
:
Source for 2 to 6 ushers for any given event
Array
:
An array of ushers
Secures a list of ushering staff, and prepares the seating space
Promise
:
An object represnting an attendee in the system
Extends Person
(String)
the unique user id for this attendee
An object represneting a person actor (usher or event attendee) in the system
(String)
In life, at any given point in time, some people are slow and others are faster. This methond is used to signal to the system that this person is done with their current task e.g getting seated (in the case of a attendee) or placing someone on a seat (in the case of an usher). They are only available for the next task (if any) when the current task is done.
Promise
:
An object representing an usher in the system
Extends Person
(String)
the unique user id for this usher
(Object)
an object with represnting the specs
of the event hall
Places a pair of attendees to their seats
Placement Formula
---
if we have Attendee-17
side = 17 % 2 === 0 ? 'right' : 'left';
so, side will be 'left'
seatNum = Math.floor(17 / 2)
so, seatNum will be 9
rowIndex = Math.floor(9 / 16)
so, rowIndex will be 0
i.e Attendee-17 will occupy seat-9 in row 0 on the left side of the hall!
(Attendee)
a variable list of attendees. 2 ideally.
Promise
:
Coordinate "provisioning" ushers and figuring out which of them is ready to admit attendees when the system needs to do so
(Object)
Promise-ified shorthand for requestAnimationframe
(Object
= {}
)
contains
waitUntil
that indicates
any initial wait time before getting the next frame
Promise
:
a promise that resolve when the then frame is available
Schedules a number of ui/render tasks (no-arg functions) to be called sequentially by requestAnimationFrame. Useful when you want to do a large number of ui/dom operations and need to keep the operations performant.
(Function)
variable number of functions
representing the ui/render tasks to queue with requestAnimationFrame
Promise
:
a promise that resolves after executing all tasks in the queue
Returns the int portion of the given id
(String)
id of a person in the system
Number
:
Shorthand for document.querySelector
Node
:
Shorthand for document.querySelectorAll
NodeList
:
A special interator/iterable that allows you to loop over the items of an array in pairs
const list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
for(let pair of pairsFrom(list)) {
// pair will be [1, 2], [3, 4] e.t.c
}
We used this to provide a pair of attendees to an usher at a given time
(array
= []
)
the array to iterate over
Iterator
:
Determines if a number is even (returns true) or not (returns false)
(Number)
number to check
Boolean
:
Generates a random number somewhere between min and max properties of the parameter. I basically lifted this from Stackoverflow :)
Name | Description |
---|---|
param0.max any
|
|
param0.min any
(default 1 )
|
Number
:
A handly util for better formatted console.log statements
(String)
Designates a sub-system of this app emitting the log messages.
Imagine logs from the UI vs logs from a service worker. These are seen as diffrent realms!
Object
:
an object with
info
,
error
, and
warn
fields used to handle
that specific kind of log messages