objs-core 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +15 -15
  2. package/package.json +31 -31
package/README.md CHANGED
@@ -7,12 +7,12 @@ Feel free to use and share ideas for the next versions!
7
7
 
8
8
 
9
9
  ## Get started
10
- Just include script or load in project by NPM (soon)
10
+ Just include script or load in project by NPM
11
11
  ```
12
12
  <script src="objs.1.0.min.js" type="text/javascript"></script>
13
13
  ```
14
14
  ```
15
- npm ... (soon)
15
+ npm i objs-core
16
16
  ```
17
17
 
18
18
 
@@ -20,17 +20,17 @@ npm ... (soon)
20
20
 
21
21
  ## Features
22
22
 
23
- ##### Develop
23
+ #### Develop
24
24
  - Elements state control
25
25
  - Store data in object itself
26
26
  - Cache server rendered elements
27
27
 
28
- ##### Test
28
+ #### Test
29
29
  - Sync/async tests
30
30
  - Console & HTML output
31
31
  - Autotests
32
32
 
33
- ##### Optimize
33
+ #### Optimize
34
34
  - Separated HTML and JS logic
35
35
  - Async loading JS, CSS, images
36
36
  - Cache JS, CSS
@@ -89,7 +89,7 @@ Almost all functions return control object with methods, let's call it **Objs**.
89
89
 
90
90
  `o.take(q)` – gets elements like **o(q)** from DOM but if there is just one element or equal number of elements to inited in **o.inits[]**, gets all inited methods.
91
91
 
92
- ##### States control
92
+ #### States control
93
93
  `o.init(states)` – returns **Objs**, creates method(s) for each state to create, change elements. State called **render** is reserved for creation elements. **states** can be [string], [object], [function] that returns [string] or [object]. After **init()** **Objs** gets a **initID** parameter for a saved object in **o.inits**. More info [here](https://fous.name/objs).
94
94
 
95
95
  `o.initState(state, [props])` – inite method and call it with props, e.g. to render/create element. **Objs** gets a **initID** parameter for a saved object in **o.inits**.
@@ -98,7 +98,7 @@ Almost all functions return control object with methods, let's call it **Objs**.
98
98
 
99
99
  `o.onError` – false as default, but can be a function that will get errors as the first parameter.
100
100
 
101
- ##### AJAX
101
+ #### AJAX
102
102
  `o.get(url, [props])` – returns promise for GET AJAX, **data** in **props** as an [object] will be converted to string parameters.
103
103
 
104
104
  `o.post(url, props)` – returns promise for POST AJAX, **data** in **props** as an [object] will be converted to body.
@@ -107,7 +107,7 @@ Almost all functions return control object with methods, let's call it **Objs**.
107
107
 
108
108
  `o.getParams([key])` – returns GET **key** value or an object with all GET parameters.
109
109
 
110
- ##### Include / load JS, CSS, images
110
+ #### Include / load JS, CSS, images
111
111
  `o.inc(sources, [callBack, callBad])` – returns [number] **setID**, gets **souces** is an object like {nameID: url, ...} where **nameID** is unique ID, **url** link to JS, CSS or image, **callBack** – function to run after everything is loaded successfully, **callBad** - function to run on failure. Functions gets **setN** as the first argument.
112
112
 
113
113
  `o.incCheck(setID)` – true if include files set number **setID** is loaded.
@@ -130,7 +130,7 @@ Almost all functions return control object with methods, let's call it **Objs**.
130
130
 
131
131
  `o.incFns` – object, array of name:status for all loaded functions.
132
132
 
133
- ##### Unit tests
133
+ #### Unit tests
134
134
  `o.test(title, test1, test2, ..., callBack)` – returns [number] **testID**, gets [string] **title** and tests like ["Test title", testFunction], where **testFunction** should return true for success and false or string for failure. If test is async, **testFunction** should get the first parameter and use it in **o.testUpdate()**.
135
135
 
136
136
  `o.testUpdate(info, result, [description])` – returns undefined, gets **info** object (the first parameter of any **testFunction**) to update test status and set it to **result** (true or false/string), **description** - additional text if needed. Used for test status update for async tests. More info [here](https://fous.name/objs).
@@ -150,7 +150,7 @@ Almost all functions return control object with methods, let's call it **Objs**.
150
150
  ### Methods
151
151
  Here are methods, **o()** means that they are available after getting elements from DOM or after init and render functions (after creating elements).
152
152
 
153
- ##### Select / DOM
153
+ #### Select / DOM
154
154
  `o().reset(q)` – clears **Objs** and get new elements by **q**, works as **o()**.
155
155
 
156
156
  `o().select([i])` – selects number **i** element from 0 to change only it, if **i** is undefined selects the last index element.
@@ -175,7 +175,7 @@ Here are methods, **o()** means that they are available after getting elements f
175
175
 
176
176
  `o().last` – the last DOM element in the set.
177
177
 
178
- ##### States
178
+ #### States
179
179
  `o().init()` – equal to **o.init()** but with elements to control.
180
180
 
181
181
  `o().initState()` – equal to **o.initState()** but with elements to control.
@@ -186,7 +186,7 @@ Here are methods, **o()** means that they are available after getting elements f
186
186
 
187
187
  `o().initID` – undefined or number. After **o().init(), o().initState()** **Objs** sets this parameter as index in **o.inits[]** to get ready elements. If elements were removed from DOM, they still there for re-use.
188
188
 
189
- ##### Direct DOM edit
189
+ #### Direct DOM edit
190
190
  `o().attr(attribute, [value])` – sets **attribute** to **value** or removes attribute if **value** is equal to '' or returns **attribute** value if **value** is undefined. If **.select()** was not used before - returns an array of values.
191
191
 
192
192
  `o().attrs()` – returns an array of all elements attributes, if **.select()** was used before - returns an object with values of one element.
@@ -213,10 +213,10 @@ Here are methods, **o()** means that they are available after getting elements f
213
213
 
214
214
  `o().textContent(content)` – sets textContent for all elements.
215
215
 
216
- ##### System
216
+ #### System
217
217
  `o().forEach(function)` – runs **function** with ab object as the first parameter: {o, self, i} where is o-function, self Objs object and i-index of current element.
218
218
 
219
- ##### Events
219
+ #### Events
220
220
  `o().on(events, function, [options])` – adds **events** listeners separated by ', ' to elements.
221
221
 
222
222
  `o().off(events, function, [options])` – removes **events** listeners separated by ', ' to elements.
@@ -227,7 +227,7 @@ Here are methods, **o()** means that they are available after getting elements f
227
227
 
228
228
  `o().ie` – object with all ever added listeners like {click: [[function, options], ...], ...}.
229
229
 
230
- ##### DOM insert
230
+ #### DOM insert
231
231
  `o().appendInside(q)` – append elements inside element **q** or got by **q** query.
232
232
 
233
233
  `o().appendBefore(q)` – append elements before element **q** or got by **q** query.
package/package.json CHANGED
@@ -1,31 +1,31 @@
1
- {
2
- "name": "objs-core",
3
- "version": "1.0.1",
4
- "homepage": "https://github.com/foggysq/objs",
5
- "repository": {
6
- "type": "git",
7
- "url": "git+https://github.com/foggysq/objs.git"
8
- },
9
- "author": "Roman Torshin <inbox@fous.name> (https://fous.name/objs)",
10
- "license": "Apache-2.0",
11
- "bugs": {
12
- "url": "https://github.com/foggysq/objs/issues"
13
- },
14
- "main": "objs.npm.1.0.js",
15
- "scripts": {
16
- "test": "echo \"Error: tests are here: https://fous.name/objs/documentation\" && exit 1"
17
- },
18
- "keywords": [
19
- "objs",
20
- "test",
21
- "script cache",
22
- "optimize",
23
- "fast develop",
24
- "lightweight",
25
- "library",
26
- "sample",
27
- "state",
28
- "dom control"
29
- ],
30
- "description": "JS library for fast develop, states control and optimisation with auto tests."
31
- }
1
+ {
2
+ "name": "objs-core",
3
+ "version": "1.0.2",
4
+ "homepage": "https://github.com/foggysq/objs",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/foggysq/objs.git"
8
+ },
9
+ "author": "Roman Torshin <inbox@fous.name> (https://fous.name/objs)",
10
+ "license": "Apache-2.0",
11
+ "bugs": {
12
+ "url": "https://github.com/foggysq/objs/issues"
13
+ },
14
+ "main": "objs.npm.1.0.js",
15
+ "scripts": {
16
+ "test": "echo \"Error: tests are here: https://fous.name/objs/documentation\" && exit 1"
17
+ },
18
+ "keywords": [
19
+ "objs",
20
+ "test",
21
+ "script cache",
22
+ "optimize",
23
+ "fast develop",
24
+ "lightweight",
25
+ "library",
26
+ "sample",
27
+ "state",
28
+ "dom control"
29
+ ],
30
+ "description": "JS library for fast develop, states control and optimisation with auto tests."
31
+ }