From 5cfdfdbcca575dc00d3a2b150540c03758d6d5e3 Mon Sep 17 00:00:00 2001 From: german Date: Wed, 8 Apr 2026 19:20:20 +0400 Subject: [PATCH] docs --- DOCS.md | 4 ++++ Find/Find.js | 15 +++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/DOCS.md b/DOCS.md index 24814dc..a23e197 100644 --- a/DOCS.md +++ b/DOCS.md @@ -125,4 +125,8 @@ map.value(/* value для замены */); // Без аргументов ве map.id(/* ID элемента */); // Вернет экземпляр map для выбранного элемента map.tag(/* TAG элемента */); // Вернет экземпляр map для выбранного элемента map.attach(/* событие */, /* функция */); // EventHandler +/* + * Функция в attach может принимать параметр. + * Этот параметр - обьект Find, map которого был вызван + */ ``` \ No newline at end of file diff --git a/Find/Find.js b/Find/Find.js index b6005f9..73689bc 100644 --- a/Find/Find.js +++ b/Find/Find.js @@ -24,11 +24,12 @@ const ERROR_CODE = "Find framework error:"; class FindObjectMap { - constructor(_root) { + constructor(_root, app) { this.root = _root; if (typeof this.root !== "object") { PrivateFind.error("Unknown root!"); } + this._app = app; return this; } select(q) { @@ -37,7 +38,7 @@ class FindObjectMap { PrivateFind.error("No objects of selector"); return undefined; } - return new FindObjectMap(o); + return new FindObjectMap(o, this._app); } read() { return this.root.innerHTML; @@ -69,7 +70,7 @@ class FindObjectMap { PrivateFind.error("No objects of selector"); return undefined; } - return new FindObjectMap(o); + return new FindObjectMap(o, this._app); } tag(q) { const o = this.root.getElementsByTagName(q); @@ -77,10 +78,12 @@ class FindObjectMap { PrivateFind.error("No objects of selector"); return undefined; } - return new FindObjectMap(o); + return new FindObjectMap(o, this._app); } attach(event, func) { - this.root.addEventListener(event, func); + this.root.addEventListener(event, () => { + func(this._app); + }); } } @@ -92,7 +95,7 @@ export default class { this.root = root; this.groups = new Array(); this.groups_count = 0; - this._map = new FindObjectMap(this.root); + this._map = new FindObjectMap(this.root, this); return this; }