Skip to content

Commit

Permalink
feat: after model utility (#7)
Browse files Browse the repository at this point in the history
* notify after load draft

* Use allSettled for this

* Clean up ESLint
  • Loading branch information
allthesignals authored and knownasilya committed Mar 30, 2018
1 parent 2282a7b commit a632142
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
10 changes: 10 additions & 0 deletions addon/utils/notify-after-load.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { allSettled } from 'ember-concurrency';

export default function notifyAfterLoad(hash, callback) {
allSettled(Object.values(hash))
.then(() => {
callback(hash);
});

return hash;
}
1 change: 1 addition & 0 deletions app/utils/notify-after-load.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from 'ember-data-tasks/utils/notify-after-load';
10 changes: 10 additions & 0 deletions tests/unit/utils/notify-after-load-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import notifyAfterLoad from 'dummy/utils/notify-after-load';
import { module, test } from 'qunit';

module('Unit | Utility | notify after load');

// Replace this with your real tests.
test('it works', function(assert) {
let result = notifyAfterLoad();
assert.ok(result);
});

0 comments on commit a632142

Please sign in to comment.