diff --git a/DOCS.md b/DOCS.md index 05fd85e..6f1be41 100644 --- a/DOCS.md +++ b/DOCS.md @@ -107,6 +107,20 @@ app.render("com.example"); // Эквивалентно app.draw(); ``` +## stable / unstable +Стабильный обьек отрисовывается всегда, например: +```js +import Find from "/home/user/Find_js/Find.js"; +const root = Find.search("my_app"); +const app = new Find(root); +app.select(0); +app.stable(); +// Добавление +app.add(['']); +app.select(1); +app.add(['']); +app.render(); +``` ## Map Map - обьект на странице. Использует следующие функции: ```js @@ -130,6 +144,7 @@ map.value(/* value для замены */); // Без аргументов ве map.id(/* ID элемента */); // Вернет экземпляр map для выбранного элемента map.tag(/* TAG элемента */); // Вернет экземпляр map для выбранного элемента map.attach(/* событие */, /* функция */); // EventHandler +map.attribute(/* Имя */, /* Значение */); // Задание атрибута /* * Функция в attach может принимать параметр. * Этот параметр - обьект Find, map которого был вызван diff --git a/Find/Find.js b/Find/Find.js index 8d01396..187c863 100644 --- a/Find/Find.js +++ b/Find/Find.js @@ -105,6 +105,10 @@ class FindObjectMap { main() { return new FindObjectMap(this._app.root, this._app, 0); } + attribute(name, val) { + this.root.setAttribute(name, val); + return this; + } } export default class Find { @@ -175,11 +179,13 @@ export default class Find { meta = new Array(); } if (addr != -1) { + const every = this.groups[addr].every; this.groups[addr] = { id: id, html: html, meta: meta, - title: document.title + title: document.title, + every: every }; return this; } @@ -196,7 +202,8 @@ export default class Find { this.groups[this.groups_count] = { id: id, html: html, - meta: meta + meta: meta, + every: false }; this.groups_count ++; return this; @@ -231,6 +238,37 @@ export default class Find { return this; } + stable(id_, html_) { + let id = undefined; + let html = undefined; + if (arguments.length == 1 || arguments.length == 0) { + id = this.__id; + if (arguments.length != 0) { + html = id_; + } else { + html = true; + } + } else { + id = id_; + html = html_; + } + if (this.groups.length == 0 || this.getNumberOfGroupFromId(id, false) == -1) { + this.group(id, [], []); + } + const stable = html; + this.groups[this.getNumberOfGroupFromId(id)] + .every = stable; + return this; + } + + unstable(id_) { + let id = id_; + if (arguments.length == 0) { + id = this.__id; + } + return this.stable(id, false); + } + correct(groupid_, elementid_, telement_) { let groupid = undefined; let elementid = undefined; @@ -328,11 +366,12 @@ export default class Find { return this; } - draw() { + draw(__use) { if (typeof this.__id === "undefined") { PrivateFind.error("Use select, before draw. Or you can use render."); } let group = this.groups[PrivateFind.arrayFindElement(this.groups, this.__id)]; + console.log(group); if (typeof group !== "object") { PrivateFind.findTypeError(group, "object"); return this; @@ -342,6 +381,14 @@ export default class Find { return this; } this.root.innerHTML = ""; + if (!(typeof __use === "string" && __use === '__undstta')) { + for (let i = 0; i < this.groups.length; i ++) { + if (typeof this.groups[i].every === "boolean" && this.groups[i].every) { + this.render(this.groups[i].id, '__undstta'); + this.iter --; + } + } + } if (typeof group.title !== "undefined" && document.title !== group.title) { document.title = group.title; } @@ -365,7 +412,7 @@ export default class Find { return this; } - render(id_) { + render(id_, __use) { let id = undefined; if (arguments.length == 0) { id = this.__id; @@ -375,7 +422,7 @@ export default class Find { const sv = this.__id; this.select(id); - this.draw(); + this.draw(__use); this.__id = sv; return this; } diff --git a/index.js b/index.js index b9eb3db..702d6fe 100644 --- a/index.js +++ b/index.js @@ -2,14 +2,17 @@ import Find from './Find/Find.js'; const ROOT_OBJECT = 'root'; -class MyApp extends Find.createApp() { +const STANDARD = 0; +const NO_MODULE = 1; + +class App extends Find.createApp() { constructor(name) { const root = Find.search(name); super(root); } init() { - this.select('com.example'); + this.select('com.find.minify'); this.setMeta(); this.setTitle(); this.setForms(); @@ -32,7 +35,7 @@ class MyApp extends Find.createApp() { } setTitle() { - this.title('Минификатор FInd.js на Find.js'); + this.title('Минификатор Find.js на Find.js'); } setForms() { @@ -40,15 +43,29 @@ class MyApp extends Find.createApp() { Find.content( `
Минификация Find.js
++ Минификация Find.js + +