Skip to content

Commit a8f2597

Browse files
committed
Fix code style
1 parent 3625464 commit a8f2597

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

JavaScript/3-function.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ const timeoutCollection = (interval) => {
44
const collection = new Map();
55
const timers = new Map();
66

7-
const facade = {};
7+
const instance = {};
88

9-
facade.set = (key, value) => {
9+
instance.set = (key, value) => {
1010
const timer = timers.get(key);
1111
if (timer) clearTimeout(timer);
1212
const timeout = setTimeout(() => {
@@ -17,9 +17,9 @@ const timeoutCollection = (interval) => {
1717
timers.set(key, timer);
1818
};
1919

20-
facade.get = (key) => collection.get(key);
20+
instance.get = (key) => collection.get(key);
2121

22-
facade.delete = (key) => {
22+
instance.delete = (key) => {
2323
const timer = timers.get(key);
2424
if (timer) {
2525
clearTimeout(timer);
@@ -28,9 +28,9 @@ const timeoutCollection = (interval) => {
2828
}
2929
};
3030

31-
facade.toArray = () => [...collection.entries()];
31+
instance.toArray = () => [...collection.entries()];
3232

33-
return facade;
33+
return instance;
3434
};
3535

3636
// Usage

JavaScript/Tasks.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Facade tasks
2+
3+
1. Analize `1-prototype.js` and improve to be compatible with frontend and backend (node.js)
4+
2. Make implementation from `2-class.js` compatible with Map interface and prepare .d.ts
5+
3. Improve implementation in `3-function.js` to be mix-ins free and better optimized for V8. Hint: return object literal from `timeoutCollection`
6+
4. Rewrite `3-function.js` to avoid setTimeout and use collection of expitation time instead
7+
5. Fix eslint warning for `4-scheduler.js` with message `Expected this to be used by class method log`, adding constructor for `Logger` class to pass instance of `Console`, pass mentioned instance to `new Scheduler({ options: { output: Console } })`
8+
6. Remove `Task` constructor: remove if statement and use either two methods or two subclasses as well for `Scheduler` method `task`

0 commit comments

Comments
 (0)