Skip to content

Commit

Permalink
skip: apply review
Browse files Browse the repository at this point in the history
  • Loading branch information
daybrush committed Nov 27, 2020
1 parent 59b60e7 commit 387e8b6
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/ImReadyManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ class ImReadyManager extends Component<ImReadyEvents> {
const loader = new ElementLoader(element, options);
const children = toArray(element.querySelectorAll<HTMLElement>(tags.join(", ")));

loader.hasLoading = children.some(el => hasLoadingAttribute(el));
loader.setHasLoading(children.some(el => hasLoadingAttribute(el)));
let withPreReady = false;

const childrenImReady = this.clone().on("error", e => {
Expand Down
3 changes: 3 additions & 0 deletions src/loaders/ElementLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ export class ElementLoader<T extends HTMLElement> extends Loader<T> {
public static EVENTS: string[] = [];
public options!: ImReadyLoaderOptions;

public setHasLoading(hasLoading: boolean) {
this.hasLoading = hasLoading;
}
public checkElement() {
if (!this.hasDataSize) {
// has not data size
Expand Down
8 changes: 4 additions & 4 deletions src/loaders/Loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ import { removeEvent, hasSizeAttribute, hasLoadingAttribute, addEvent } from "..
export default abstract class Loader<T extends HTMLElement = any> extends Component<ImReadyLoaderEvents> {
public static EVENTS: string[] = [];
public options!: ImReadyLoaderOptions;
public isReady = false;
public isPreReady = false;
public hasDataSize = false;
public hasLoading = false;
public abstract checkElement(): boolean;
protected element!: T;
protected isReady = false;
protected isPreReady = false;
protected hasDataSize = false;
protected hasLoading = false;

constructor(element: HTMLElement, options: Partial<ImReadyLoaderOptions> = {}) {
super();
Expand Down
1 change: 0 additions & 1 deletion test/unit/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,5 @@ export function expectOrders(events: EventType[], values: string[]) {
// Then
const eventNames = events.map(e => e.eventType);

console.log(eventNames);
expect(eventNames).to.be.deep.equals(values);
}

0 comments on commit 387e8b6

Please sign in to comment.