forked from naver/egjs-conveyer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
youjin-ahn
committed
Sep 22, 2023
1 parent
34785f2
commit 40b491b
Showing
74 changed files
with
3,444 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,25 @@ | |
All notable changes to this project will be documented in this file. | ||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. | ||
|
||
## [1.7.0](https://github.com/naver/egjs-conveyer/compare/@egjs/[email protected]...@egjs/[email protected]) (2023-09-22) | ||
|
||
|
||
### :rocket: New Features | ||
|
||
* add useResizeObserver option (#51) ([57138e7](https://github.com/naver/egjs-conveyer/commit/57138e7923e00705e6d275bbd750c2e0db90cfea)) | ||
|
||
|
||
### :house: Code Refactoring | ||
|
||
* remove itemElements member ([c666863](https://github.com/naver/egjs-conveyer/commit/c6668637661dcb062fd98b5058af6fc987ca200f)) | ||
|
||
|
||
### :mega: Other | ||
|
||
* update packages versions ([34785f2](https://github.com/naver/egjs-conveyer/commit/34785f27897a3c7b983bc9f18ce50fdc517c9757)) | ||
|
||
|
||
|
||
## [1.6.2](https://github.com/naver/egjs-conveyer/compare/@egjs/[email protected]...@egjs/[email protected]) (2023-08-25) | ||
|
||
|
||
|
14 changes: 14 additions & 0 deletions
14
packages/docs/versioned_docs/version-1.7.0/api/CONVEYER_METHODS.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
custom_edit_url: null | ||
--- | ||
|
||
```ts | ||
const CONVEYER_METHODS | ||
``` | ||
|
||
<div> | ||
|
||
</div> | ||
|
||
<p>egjs-conveyer<br />Copyright (c) 2022-present NAVER Corp.<br />MIT license</p> | ||
|
211 changes: 211 additions & 0 deletions
211
packages/docs/versioned_docs/version-1.7.0/api/Component.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,211 @@ | ||
--- | ||
custom_edit_url: null | ||
--- | ||
|
||
```ts | ||
class Component | ||
``` | ||
|
||
<div> | ||
|
||
</div> | ||
|
||
<p>A class used to manage events in a component</p> | ||
|
||
<div className="container"> | ||
<div className="row mb-2"><div className="col col--6"><strong>Properties</strong></div><div className="col col--6"><strong>Methods</strong></div></div> | ||
<div className="row"><div className="col col--6"><a href="#VERSION">VERSION</a><span className="badge badge--info margin-left--sm">static</span></div><div className="col col--6"><a href="#trigger">trigger</a><br/><a href="#once">once</a><br/><a href="#hasOn">hasOn</a><br/><a href="#on">on</a><br/><a href="#off">off</a></div></div> | ||
</div> | ||
|
||
## Properties | ||
### VERSION {#VERSION} | ||
|
||
<div> | ||
<span className="badge badge--info">static</span> | ||
</div> | ||
|
||
<p>Version info string</p> | ||
|
||
**Type**: string | ||
|
||
Component.VERSION; // ex) 3.0.0 | ||
|
||
## Methods | ||
|
||
### trigger {#trigger} | ||
|
||
<div> | ||
|
||
</div> | ||
|
||
<p>Trigger a custom event.</p> | ||
|
||
**Returns**: this | ||
- <p>An instance of the component itself</p> | ||
|
||
|PARAMETER|TYPE|OPTIONAL|DEFAULT|DESCRIPTION| | ||
|:---:|:---:|:---:|:---:|:---:| | ||
|event|string \| ComponentEvent|||<p>The name of the custom event to be triggered or an instance of the ComponentEvent</p>| | ||
|params|Array<any> \| $ts:...|||<p>Event data to be sent when triggering a custom event </p>| | ||
|
||
```ts | ||
import Component, { ComponentEvent } from "@egjs/component"; | ||
class Some extends Component<{ | ||
beforeHi: ComponentEvent<{ foo: number; bar: string }>; | ||
hi: { foo: { a: number; b: boolean } }; | ||
someEvent: (foo: number, bar: string) => void; | ||
someOtherEvent: void; // When there's no event argument | ||
}> { | ||
some(){ | ||
if(this.trigger("beforeHi")){ // When event call to stop return false. | ||
this.trigger("hi");// fire hi event. | ||
} | ||
} | ||
} | ||
const some = new Some(); | ||
some.on("beforeHi", e => { | ||
if(condition){ | ||
e.stop(); // When event call to stop, `hi` event not call. | ||
} | ||
// `currentTarget` is component instance. | ||
console.log(some === e.currentTarget); // true | ||
typeof e.foo; // number | ||
typeof e.bar; // string | ||
}); | ||
some.on("hi", e => { | ||
typeof e.foo.b; // boolean | ||
}); | ||
// If you want to more know event design. You can see article. | ||
// https://github.com/naver/egjs-component/wiki/How-to-make-Component-event-design%3F | ||
``` | ||
|
||
### once {#once} | ||
|
||
<div> | ||
|
||
</div> | ||
|
||
<p>Executed event just one time.</p> | ||
|
||
**Returns**: this | ||
- <p>An instance of the component itself</p> | ||
|
||
|PARAMETER|TYPE|OPTIONAL|DEFAULT|DESCRIPTION| | ||
|:---:|:---:|:---:|:---:|:---:| | ||
|eventName|string \| $ts:...|||<p>The name of the event to be attached or an event name - event handler mapped object.</p>| | ||
|handlerToAttach|function \| $ts:...|✔️||<p>The handler function of the event to be attached </p>| | ||
|
||
```ts | ||
import Component, { ComponentEvent } from "@egjs/component"; | ||
class Some extends Component<{ | ||
hi: ComponentEvent; | ||
}> { | ||
hi() { | ||
alert("hi"); | ||
} | ||
thing() { | ||
this.once("hi", this.hi); | ||
} | ||
} | ||
var some = new Some(); | ||
some.thing(); | ||
some.trigger(new ComponentEvent("hi")); | ||
// fire alert("hi"); | ||
some.trigger(new ComponentEvent("hi")); | ||
// Nothing happens | ||
``` | ||
|
||
### hasOn {#hasOn} | ||
|
||
<div> | ||
|
||
</div> | ||
|
||
<p>Checks whether an event has been attached to a component.</p> | ||
|
||
**Returns**: boolean | ||
- <p>Indicates whether the event is attached. </p> | ||
|
||
|PARAMETER|TYPE|OPTIONAL|DEFAULT|DESCRIPTION| | ||
|:---:|:---:|:---:|:---:|:---:| | ||
|eventName|string|||<p>The name of the event to be attached </p>| | ||
|
||
```ts | ||
import Component from "@egjs/component"; | ||
class Some extends Component<{ | ||
hi: void; | ||
}> { | ||
some() { | ||
this.hasOn("hi");// check hi event. | ||
} | ||
} | ||
``` | ||
|
||
### on {#on} | ||
|
||
<div> | ||
|
||
</div> | ||
|
||
<p>Attaches an event to a component.</p> | ||
|
||
**Returns**: this | ||
- <p>An instance of a component itself</p> | ||
|
||
|PARAMETER|TYPE|OPTIONAL|DEFAULT|DESCRIPTION| | ||
|:---:|:---:|:---:|:---:|:---:| | ||
|eventName|string \| $ts:...|||<p>The name of the event to be attached or an event name - event handler mapped object.</p>| | ||
|handlerToAttach|function \| $ts:...|✔️||<p>The handler function of the event to be attached </p>| | ||
|
||
```ts | ||
import Component, { ComponentEvent } from "@egjs/component"; | ||
class Some extends Component<{ | ||
hi: void; | ||
}> { | ||
hi() { | ||
console.log("hi"); | ||
} | ||
some() { | ||
this.on("hi",this.hi); //attach event | ||
} | ||
} | ||
``` | ||
|
||
### off {#off} | ||
|
||
<div> | ||
|
||
</div> | ||
|
||
<p>Detaches an event from the component.<br/>If the <code>eventName</code> is not given this will detach all event handlers attached.<br/>If the <code>handlerToDetach</code> is not given, this will detach all event handlers for <code>eventName</code>.</p> | ||
|
||
**Returns**: this | ||
- <p>An instance of a component itself </p> | ||
|
||
|PARAMETER|TYPE|OPTIONAL|DEFAULT|DESCRIPTION| | ||
|:---:|:---:|:---:|:---:|:---:| | ||
|eventName|string \| $ts:...|✔️||<p>The name of the event to be detached </p>| | ||
|handlerToDetach|function \| $ts:...|✔️||<p>The handler function of the event to be detached </p>| | ||
|
||
```ts | ||
import Component, { ComponentEvent } from "@egjs/component"; | ||
class Some extends Component<{ | ||
hi: void; | ||
}> { | ||
hi() { | ||
console.log("hi"); | ||
} | ||
some() { | ||
this.off("hi",this.hi); //detach event | ||
} | ||
} | ||
``` | ||
|
Oops, something went wrong.