You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/tutorial/03-advanced-svelte/04-actions/01-actions/README.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,30 +2,30 @@
2
2
title: The use directive
3
3
---
4
4
5
-
Actions are essentially element-level lifecycle functions. They're useful for things like:
5
+
アクションは基本的に要素レベルのライフサイクル関数です。これらは以下のような場合に便利です。
6
6
7
-
-interfacing with third-party libraries
8
-
-lazy-loaded images
9
-
-tooltips
10
-
-adding custom event handlers
7
+
-サードパーティライブラリとの連携
8
+
-画像の遅延読み込み
9
+
-ツールチップ
10
+
-カスタムイベントハンドラの追加
11
11
12
-
In this app, we want to make the orange modal close when the user clicks outside it. It has an event handler for the `outclick`event, but it isn't a native DOM event. We have to dispatch it ourselves. First, import the `clickOutside`function...
12
+
このアプリでは、オレンジ色のモーダルを、その外側をクリックしたときに閉じるようにしたいと思います。このアプリには `outclick`イベント用のイベントハンドラがありますが、これはネイティブの DOM イベントではありません。このイベントを自分でディスパッチする必要があります。まず、`clickOutside`関数をインポートします…
Open the `click_outside.js`file. Like transition functions, an action function receives a `node` (which is the element that the action is applied to) and some optional parameters, and returns an action object. That object can have a `destroy`function, which is called when the element is unmounted.
Here, we're using a `longpress`action that fires an event with the same name whenever the user presses and holds the button for a given duration. Right now, if you switch over to the `longpress.js`file, you'll see it's hardcoded to 500ms.
0 commit comments