Skip to content
This repository was archived by the owner on Oct 11, 2023. It is now read-only.

Conversation

@SR2k
Copy link
Contributor

@SR2k SR2k commented Aug 27, 2020

  • 主要变更

    • [+] 增加 my.createIntersectionObserver 及相关类型的声明。
  • Refactor

    • ComponentOptions 重构为 interface 以便业务自行扩展。

SR2k added 4 commits August 27, 2020 09:33
Signed-off-by: Luozhou (Siyuan Cao) <luozhou.csy@alibaba-inc.com>
Signed-off-by: Luozhou (Siyuan Cao) <luozhou.csy@alibaba-inc.com>
Signed-off-by: Luozhou (Siyuan Cao) <luozhou.csy@alibaba-inc.com>
Copy link
Collaborator

@yibuyisheng yibuyisheng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Page 和 App 也同步改一下?

*/
observe(
targetSelector: string,
callback: (res: IObserveResult) => any,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

返回值要不用 void?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

有的时候就用箭头函数的,感觉用 void 会限制这个地方?

my.createIntersectionObserver()
  .relativeToViewport()
  .observe('.className', node => this.nodes.push(node)) // <- 用 void 会报错

}

type ComponentOptions<
interface InternalComponentOptions<P, D, M> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IInternalComponentOptions

SR2k added 2 commits August 27, 2020 11:57
Signed-off-by: Luozhou (Siyuan Cao) <luozhou.csy@alibaba-inc.com>
Signed-off-by: Luozhou (Siyuan Cao) <luozhou.csy@alibaba-inc.com>
* @file IntersectionObserver 对象,用于推断某些节点是否可以被用户看见、有多大比例可以被用户看见。
*/
declare namespace my {
namespace intersectionObserver {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不需要加这个 namespace 吧

selectAll?: boolean;
}

interface IRect {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IRect -> IIntersectionObserverRect

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants