Skip to content

Commit

Permalink
In view: scripts-base dependency updated
Browse files Browse the repository at this point in the history
  • Loading branch information
FilipChalupa committed Jul 15, 2019
1 parent a840e1f commit d9e686a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion scripts-components/in-view/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@
"isinview": "^2.0.4-0"
},
"peerDependencies": {
"@mangoweb/scripts-base": "0.0.5"
"@mangoweb/scripts-base": "0.0.8"
}
}
18 changes: 9 additions & 9 deletions scripts-components/in-view/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,23 @@ export class InView extends Component<InViewData> {
protected readonly isBelowViewClass: string
protected readonly isSeenClass: string

public constructor(el: HTMLElement, data: InViewData) {
super(el, data)
public constructor(el: HTMLElement, props: InViewData) {
super(el, props)

if (!isSupported()) {
throw new ComponentInitializationError('InView component not supported. Add IntersectionObserver polyfill.')
}

this.targets = this.data.targets ? this.getChildren(this.data.targets) : this.el
this.targets = this.props.targets ? this.getChildren(this.props.targets) : this.el

if (this.data.threshold) {
this.options.threshold = this.data.threshold
if (this.props.threshold) {
this.options.threshold = this.props.threshold
}

this.isAboveViewClass = this.getProp('isAboveViewClass', 'is-aboveView')
this.isInViewClass = this.getProp('isInViewClass', 'is-inView')
this.isBelowViewClass = this.getProp('isBelowViewClass', 'is-belowView')
this.isSeenClass = this.getProp('isSeenClass', 'is-seen')
this.isAboveViewClass = this.getPropOrElse('isAboveViewClass', 'is-aboveView')
this.isInViewClass = this.getPropOrElse('isInViewClass', 'is-inView')
this.isBelowViewClass = this.getPropOrElse('isBelowViewClass', 'is-belowView')
this.isSeenClass = this.getPropOrElse('isSeenClass', 'is-seen')
}

public init() {
Expand Down

0 comments on commit d9e686a

Please sign in to comment.