-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.js
More file actions
57 lines (46 loc) · 1.06 KB
/
example.js
File metadata and controls
57 lines (46 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//var _OBJY = require('./objy.js');
import _OBJY from './objy.js'
var OBJY = new _OBJY();
OBJY.Logger.enabled = ['none']
OBJY.useUser({username: "hejh"})
OBJY.define({
name: 'template',
pluralName: 'templates',
})
OBJY.define({
name: 'object',
pluralName: 'objects',
templateFamily: 'template',
})
OBJY.template({
name: "template123",
nested: {
inner: {
type: "boolean",
value: true
}
},
evt: {
type: "event",
interval: "P1Y",
action: "console.log(1)"
},
properties: {
lastnam: "sgsg",
supername: {
type: "event",
date: '2024-05-15T13:49:01.704Z',
action: 'hello'
}
}
}).add(data => {
console.log('added', data)
data.addProperty('properties.hello', {type: "number", value: "1"}).update(d => {
console.log('updated', d)
})
OBJY.object({inherits: [data._id]}).add((o) => {
OBJY.object(o._id).get(o2 => {
console.log('o2', o2)
})
})
});