From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/ja/glossary/static_method/index.html | 54 ++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 files/ja/glossary/static_method/index.html (limited to 'files/ja/glossary/static_method') diff --git a/files/ja/glossary/static_method/index.html b/files/ja/glossary/static_method/index.html new file mode 100644 index 0000000000..a2fb2df971 --- /dev/null +++ b/files/ja/glossary/static_method/index.html @@ -0,0 +1,54 @@ +--- +title: Static method (静的メソッド) +slug: Glossary/Static_method +tags: + - CodingScripting + - Glossary + - JavaScript + - Method + - Static + - Static Method + - メソッド + - 用語集 + - 静的 + - 静的メソッド +translation_of: Glossary/Static_method +--- +

静的メソッド (または 静的関数) とは、{{Glossary("method","メソッド")}}のうち{{Glossary("object","オブジェクト")}}のメンバーとして定義されているものの、コンストラクターで生成されたオブジェクトインスタンスからではなく、API のオブジェクトコンストラクターから直接アクセスできるものです。

+ +

Web API では、静的メソッドはインターフェイスで定義されているものの、先にその型のオブジェクトのインスタンス化をせずに呼び出すことができます。

+ +

オブジェクトインスタンスに対して呼び出されるメソッドは、インスタンスメソッドと呼ばれます。

+ +

+ +

Notifications API では、{{domxref("Notification.requestPermission()")}} メソッドは実際は {{domxref("Notification")}} コンストラクター自身に対して呼び出されます。— これが静的メソッドです。

+ +
let promise = Notification.requestPermission();
+ +

一方で、{{domxref("Notification.close()")}} メソッドはインスタンスメソッドです。— これは特定の通知オブジェクトインスタンスに対して呼び出され、これが表現するシステム通知を閉じます。

+ +
let myNotification = new Notification('This is my notification');
+
+myNotification.close();
+ + -- cgit v1.2.3-54-g00ecf