From a708940a1120cc69b9658b103b66baceeb5da285 Mon Sep 17 00:00:00 2001 From: Bradley Farias Date: Wed, 22 Jul 2020 13:46:22 -0500 Subject: [PATCH 1/2] Add handler term from plenary description --- terminology.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/terminology.md b/terminology.md index ea09f03..4577784 100644 --- a/terminology.md +++ b/terminology.md @@ -313,6 +313,27 @@ To make something a first-class concept in a language specification, such that i #### References - [Reification](https://en.wikipedia.org/wiki/Reification_(computer_science)) +### Handler + +#### Definition + +A parameter value that is a JavaScript object with properties looked up lazily. It is used to configure behavior of a function. Methods on the options bag object should be invoked with the handler as the default value for `this`. It is expected that this parameter has specific well known properties in their structure. Handlers are expected to potentially be extended over time. + +The definition here is a bit fuzzy as some parameters are objects but not options bags. + +#### Example + +```js +const handler = { + getCount: 0, + get(target, key, receiver) { + const count = this.getCount++; + return count; + } +}; +new Proxy(obj, handler); +``` + TEMPLATE ### [NAME HERE] From 1347a2eceb0848f5052aa992cd30fe61d2c5fc64 Mon Sep 17 00:00:00 2001 From: Bradley Farias Date: Wed, 22 Jul 2020 15:13:34 -0500 Subject: [PATCH 2/2] Update terminology.md Co-authored-by: Jordan Harband --- terminology.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terminology.md b/terminology.md index 4577784..5e38ac5 100644 --- a/terminology.md +++ b/terminology.md @@ -313,7 +313,7 @@ To make something a first-class concept in a language specification, such that i #### References - [Reification](https://en.wikipedia.org/wiki/Reification_(computer_science)) -### Handler +### Handler Object #### Definition