Skip to content

Commit

Permalink
♻️ The Pledge class is now a child of Placeholder and no longer a…
Browse files Browse the repository at this point in the history
…n `Informer`
  • Loading branch information
skerit committed Feb 12, 2024
1 parent bd37c3b commit 2251f7e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* Make `Blast.executeAfterLoadingCycle()` keep `did_initial_load` variable alone
* Add `String.parseQuoted(input)` to parse json-like string values
* Add the `Placeholder` and `Trail` class to the Develry namespace
* The `Pledge` class is now a child of `Placeholder` and no longer an `Informer`

## 0.8.18 (2024-01-19)

Expand Down
20 changes: 19 additions & 1 deletion lib/pledge.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const SCHEDULE_EXECUTOR = Symbol('schedule_executor'),
* @since 0.8.15
* @version 0.8.15
*/
const AbstractPledge = Fn.inherits('Informer', function AbstractPledge(executor) {});
const AbstractPledge = Fn.inherits('Develry.Placeholder', '@', function AbstractPledge(executor) {});

AbstractPledge.setStatic('RESOLVED_VALUE', RESOLVED_VALUE);

Expand Down Expand Up @@ -829,6 +829,24 @@ Pledge.setMethod(function _addProgressPledge(pledge) {
};
});

/**
* Get the resolved value of this pledge.
*
* @author Jelle De Loecker <[email protected]>
* @since 0.9.0
* @version 0.9.0
*
* @return {*}
*/
Pledge.setMethod(function getResolvedValue() {

if (this[STATE] != RESOLVED) {
return this;
}

return this[RESOLVED_VALUE];
});

/**
* Resolve with the given value
*
Expand Down

0 comments on commit 2251f7e

Please sign in to comment.