isomorfeus-preact 10.6.16 → 10.6.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/preact/props.rb +18 -0
- data/lib/preact/state.rb +20 -0
- data/lib/preact/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ccc4b9e2e9c992e268704b23e9e1fdf21d323c5f3a38fb92ec8e35c1b512f2b
|
4
|
+
data.tar.gz: 27bc9c10c4627bbbeb07e087c46d29e5e74be6b1a33b336f8843646eb9ea9236
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e12591ed06bdc60ab93eb88d9d208e2b16159c89901c3a07dd387d2a4a434b93d798855109dc270689bdfeceea1ffd59e0ae4c8e1532e70bbba818127d031c82
|
7
|
+
data.tar.gz: efc7de705de7b59cb84ab654c06b8d10836a631e92a21a51607f310e70ca35f216657ba6639bce91279af5816f59cef6be4949acb0a3954c04cb48d538aa4414
|
data/lib/preact/props.rb
CHANGED
@@ -11,6 +11,24 @@ module Preact
|
|
11
11
|
}
|
12
12
|
end
|
13
13
|
|
14
|
+
def [](prop)
|
15
|
+
%x{
|
16
|
+
const p = #@native.props;
|
17
|
+
if (typeof p[prop] === 'undefined') {
|
18
|
+
prop = Opal.Preact.lower_camelize(prop);
|
19
|
+
if (typeof p[prop] === 'undefined') { return nil; }
|
20
|
+
}
|
21
|
+
return p[prop];
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
25
|
+
def key?(k)
|
26
|
+
%x{
|
27
|
+
if (typeof #@native.props[k] !== 'undefined') { return true; }
|
28
|
+
return false;
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
14
32
|
def method_missing(prop, *args, &block)
|
15
33
|
%x{
|
16
34
|
const p = #@native.props;
|
data/lib/preact/state.rb
CHANGED
@@ -13,6 +13,26 @@ module Preact
|
|
13
13
|
}
|
14
14
|
end
|
15
15
|
|
16
|
+
def [](key)
|
17
|
+
%x{
|
18
|
+
if (typeof #@native.state[key] === 'undefined') { return nil; }
|
19
|
+
return #@native.state[key];
|
20
|
+
}
|
21
|
+
end
|
22
|
+
|
23
|
+
def []=(key)
|
24
|
+
new_state = `{}`
|
25
|
+
new_state.JS[(`key.endsWith('=')` ? key.chop : key)] = args[0]
|
26
|
+
@native.JS.setState(new_state, `null`)
|
27
|
+
end
|
28
|
+
|
29
|
+
def key?(k)
|
30
|
+
%x{
|
31
|
+
if (typeof #@native.state[k] !== 'undefined') { return true; }
|
32
|
+
return false;
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
16
36
|
def method_missing(key, *args, &block)
|
17
37
|
if `args.length > 0`
|
18
38
|
new_state = `{}`
|
data/lib/preact/version.rb
CHANGED