@kizmann/pico-js 0.3.25 → 0.3.28

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kizmann/pico-js",
3
- "version": "0.3.25",
3
+ "version": "0.3.28",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "author": "Eduard Kizmann <kizmann@protonmail.ch>",
@@ -102,7 +102,7 @@ export class Element
102
102
  /**
103
103
  * Bind callback on selector.
104
104
  */
105
- static observe(key)
105
+ static observe(key, plain = false)
106
106
  {
107
107
  let selector = this.getPrefix(key);
108
108
 
@@ -126,6 +126,10 @@ export class Element
126
126
  Dom.find(el).attr(selector)
127
127
  );
128
128
 
129
+ if ( plain && Any.isEmpty(options) ) {
130
+ options = { _plain: Dom.find(el).attr(selector) };
131
+ }
132
+
129
133
  if ( document.body.contains(el) ) {
130
134
  return;
131
135
  }
@@ -139,6 +143,10 @@ export class Element
139
143
  Dom.find(el).attr(selector)
140
144
  );
141
145
 
146
+ if ( plain && Any.isEmpty(options) ) {
147
+ options = { _plain: Dom.find(el).attr(selector) };
148
+ }
149
+
142
150
  this.bind(key, el, options);
143
151
  });
144
152
 
@@ -27,6 +27,10 @@ export class Obj
27
27
  keys = keys.join('.');
28
28
  }
29
29
 
30
+ if ( obj[keys] !== undefined && obj[keys] !== null ) {
31
+ return obj[keys];
32
+ }
33
+
30
34
  if ( ! Any.isString(keys) ) {
31
35
  keys = keys.toString();
32
36
  }
@@ -60,6 +64,10 @@ export class Obj
60
64
  keys = keys.toString();
61
65
  }
62
66
 
67
+ if ( obj[keys] !== undefined ) {
68
+ obj[keys] = val; return obj;
69
+ }
70
+
63
71
  keys = keys.split('.');
64
72
 
65
73
  let index = 0, length = keys.length, nested = obj;