Skip to content

Commit

Permalink
fix docs
Browse files Browse the repository at this point in the history
  • Loading branch information
runspired committed May 9, 2021
1 parent 86618bf commit fa98b30
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 14 deletions.
11 changes: 5 additions & 6 deletions packages/-ember-data/node-tests/fixtures/expected.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,8 @@ module.exports = {
'(private) @ember-data/store InternalModelFactory#lookup',
'(private) @ember-data/store InternalModelFactory#peek',
'(private) @ember-data/store ManyArray#isPolymorphic',
'(private) @ember-data/store ManyArray#promise',
'(private) @ember-data/store ManyArray#relationship',
'(private) @ember-data/store RecordArray#_createSnapshot',
'(private) @ember-data/store RecordArray#_dissociateFromOwnRecords',
'(private) @ember-data/store RecordArray#_pushIdentifiers',
'(private) @ember-data/store RecordArray#_removeIdentifiers',
'(private) @ember-data/store RecordArray#_takeSnapshot',
'(private) @ember-data/store RecordArray#_unregisterFromManager',
'(private) @ember-data/store RecordArray#content',
'(private) @ember-data/store RecordArray#objectAtContent',
'(private) @ember-data/store RecordArray#store',
Expand Down Expand Up @@ -414,6 +408,11 @@ module.exports = {
'(public) @ember-data/model PromiseManyArray#isSettled',
'(public) @ember-data/model PromiseManyArray#length',
'(public) @ember-data/model PromiseManyArray#links',
"(public) @ember-data/model PromiseManyArray#catch",
"(public) @ember-data/model PromiseManyArray#finally",
"(public) @ember-data/model PromiseManyArray#meta",
"(public) @ember-data/model PromiseManyArray#reload",
"(public) @ember-data/model PromiseManyArray#then",
'(public) @ember-data/store ManyArray#links',
'(public) @ember-data/store Store#identifierCache'
],
Expand Down
2 changes: 2 additions & 0 deletions packages/model/addon/-private/system/many-array.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ export default EmberObject.extend(MutableArray, DeprecatedEvented, {
this._meta = this._meta || null;

/**
* Retrieve the links for this relationship
*
@property {Object | null} links
@public
*/
Expand Down
51 changes: 50 additions & 1 deletion packages/model/addon/-private/system/promise-many-array.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ let _ExportedClass;
```
@class PromiseManyArray
@private
@public
*/
class PromiseManyArray {
declare promise: Promise<any> | null;
Expand Down Expand Up @@ -78,34 +78,66 @@ class PromiseManyArray {
//---- Properties/Methods from the PromiseProxyMixin that we will keep as our API

/**
* Whether the loading promise is still pending
*
* @property {boolean} isPending
* @public
*/
@tracked isPending: boolean = false;
/**
* Whether the loading promise rejected
*
* @property {boolean} isRejected
* @public
*/
@tracked isRejected: boolean = false;
/**
* Whether the loading promise succeeded
*
* @property {boolean} isFulfilled
* @public
*/
@tracked isFulfilled: boolean = false;
/**
* Whether the loading promise completed (resolved or rejected)
*
* @property {boolean} isSettled
* @public
*/
@tracked isSettled: boolean = false;

/**
* chain this promise
*
* @method then
* @public
* @param success
* @param fail
* @returns Promise
*/
then(s, f) {
return this.promise!.then(s, f);
}

/**
* catch errors thrown by this promise
* @method catch
* @public
* @param callback
* @returns Promise
*/
catch(cb) {
return this.promise!.catch(cb);
}

/**
* run cleanup after this promise completes
*
* @method finally
* @public
* @param callback
* @returns Promise
*/
finally(cb) {
return this.promise!.finally(cb);
}
Expand All @@ -131,6 +163,23 @@ class PromiseManyArray {
return this.content ? this.content.links : undefined;
}

/**
* Retrieve the meta for this relationship
* @property meta
* @public
*/
@dependentKeyCompat
get meta() {
return this.content ? this.content.meta : undefined;
}

/**
* Reload the relationship
* @method reload
* @public
* @param options
* @returns
*/
reload(options) {
assert('You are trying to reload an async manyArray before it has been created', this.content);
this.content.reload(options);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ let RecordArray = ArrayProxy.extend(DeprecatedEvented, {
return PromiseArray.create({ promise });
},

/*
/**
@method _unregisterFromManager
@internal
*/
Expand Down Expand Up @@ -236,9 +236,9 @@ let RecordArray = ArrayProxy.extend(DeprecatedEvented, {
return new SnapshotRecordArray(this, this.get('meta'), options);
},

/*
/**
@method _dissociateFromOwnRecords
@private
@internal
*/
_dissociateFromOwnRecords() {
this.get('content').forEach((identifier) => {
Expand All @@ -250,11 +250,11 @@ let RecordArray = ArrayProxy.extend(DeprecatedEvented, {
});
},

/*
/**
Adds identifiers to the `RecordArray` without duplicates
@method _pushIdentifiers
@private
@internal
@param {StableRecordIdentifier[]} identifiers
*/
_pushIdentifiers(identifiers) {
Expand All @@ -265,7 +265,7 @@ let RecordArray = ArrayProxy.extend(DeprecatedEvented, {
Removes identifiers from the `RecordArray`.
@method _removeIdentifiers
@private
@internal
@param {StableRecordIdentifier[]} identifiers
*/
_removeIdentifiers(identifiers) {
Expand All @@ -274,7 +274,7 @@ let RecordArray = ArrayProxy.extend(DeprecatedEvented, {

/**
@method _takeSnapshot
@private
@internal
*/
_takeSnapshot() {
return get(this, 'content').map((identifier) =>
Expand Down

0 comments on commit fa98b30

Please sign in to comment.