This is the code I’m running:
<script type="text/discourse-plugin" version="0.8">
const { run } = Ember;
api.decorateCooked($elem => {
run.scheduleOnce("actions", () => {
// Must run before the scheduled actions from TOC component.
});
})
The TOC component uses the same interface to schedule its actions.
According to the Ember docs, the schedule interface:
Adds the passed target/method and any optional arguments to the named queue to be executed at the end of the RunLoop
This term “add” suggests a FIFO ordering of scheduled actions. Therefore the order that the call to schedule is critical here.