Methods
build() → {Promise}
This function returns a Promise resolving the EDT object you just instanciated with Courses loaded in it
Returns:
- Type:
-
Promise
containing EDT object with courses loaded
Example
new EDT(anyGroup, anyDate).build().then(edt => {
// Treat your EDT object
}).catch(err => {
// Treat your error
})
getClosestCourse() → {Course}
Get the nearest next course
Returns:
- Type:
-
Course
Example
new EDT(anyDate, anyDate).build().then(edt => {
// Note : You're not getting the course the closest to anyDate, but the closest to now
const next = edt.getClosestCourse()
}).catch(err => {
// Treat your error
})
getCourses() → {Array.<Course>}
Get all the new courses (courses from today, to calendar end)
Returns:
- Type:
-
Array.<Course>
Example
new EDT(anyGroup, anyDate).build().then(edt => {
// You'll end up getting only courses starting at anyDate
const allCourses = edt.getCourses()
}).catch(err => {
// Treat your error
})
getCoursesFrom(dateopt) → {Array.<Course>}
Get courses of date you pass as parameter
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
date |
Date
|
<optional> |
new Date() |
Date when course will be picked-up |
Example
new EDT(anyDate, anyDate).build().then(edt => {
const tomorrowCourses = edt.getCoursesFrom(dateOfTomorrow)
}).catch(err => {
// Treat your error
})