1
0
mirror of https://github.com/flarum/core.git synced 2025-07-11 20:06:23 +02:00

chore: 1.2 JS clean-up (#3214)

* fix: `extend.ts` TS error

* docs: fix incorrect JS docblocks

* chore: simplify some code

* chore: remove usages of prefixed JS function

* chore: consistent empty return types

* chore: format

* fix: typing errors

* chore: remove unneeded `@public` docblock modifiers

* Apply suggestions from code review

* Update js/src/forum/utils/slidable.js

Co-authored-by: Alexander Skvortsov <38059171+askvortsov1@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Alexander Skvortsov <38059171+askvortsov1@users.noreply.github.com>
This commit is contained in:
David Wheatley
2021-12-27 19:58:18 +01:00
committed by GitHub
parent 4df72e5ac6
commit d268894e61
60 changed files with 292 additions and 355 deletions

View File

@ -38,7 +38,7 @@ export default class PostsUserPage extends UserPage {
/**
* The number of activity items to load per request.
*
* @type {Integer}
* @type {number}
*/
this.loadLimit = 20;
@ -100,8 +100,6 @@ export default class PostsUserPage extends UserPage {
/**
* Clear and reload the user's activity feed.
*
* @public
*/
refresh() {
this.loading = true;
@ -115,8 +113,8 @@ export default class PostsUserPage extends UserPage {
/**
* Load a new page of the user's activity feed.
*
* @param {Integer} [offset] The position to start getting results from.
* @return {Promise}
* @param {number} [offset] The position to start getting results from.
* @return {Promise<import('../../common/models/Post').default[]>}
* @protected
*/
loadResults(offset) {
@ -132,8 +130,6 @@ export default class PostsUserPage extends UserPage {
/**
* Load the next page of results.
*
* @public
*/
loadMore() {
this.loading = true;
@ -143,13 +139,13 @@ export default class PostsUserPage extends UserPage {
/**
* Parse results and append them to the activity feed.
*
* @param {Post[]} results
* @return {Post[]}
* @param {import('../../common/models/Post').default[]} results
* @return {import('../../common/models/Post').default[]}
*/
parseResults(results) {
this.loading = false;
[].push.apply(this.posts, results);
this.posts.push(results);
this.moreResults = results.length >= this.loadLimit;
m.redraw();