-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
167 lines (151 loc) · 4.37 KB
/
index.js
File metadata and controls
167 lines (151 loc) · 4.37 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
var app = new Vue({
el: '#app',
watch: {
currentExample: function() {
setTimeout(function() {
hljs.initHighlighting.called = false;
hljs.initHighlighting();
}, 1)
}
},
methods: {
loadExample: function () {
if(this.currentExample == this.examples.length) this.currentExample = -1
this.currentExample = this.currentExample+1
}
},
data: {
currentExample: 0,
currentApplication: 0,
showInstallInstructions: false,
currentPreview: 1,
currentLang: 'JS',
langs: [ /*'JS', 'CLI'*/ ],
previewItems: [{ name: 'Objects', index: 1 }, { name: 'Behaviours', index: 2 }, { name: 'CRUD API', index: 3 }, { name: 'Extendable', index: 4 }],
examples: [
{ name: "Objects", header: '', icon: 'feat-object.png', code: `OBJY.define({
name: "object",
storage: new MongoMapper(...)
});
OBJY.object({
name: "box",
color: "green",
expires: { // a date-based event
type: "event",
date: "08-08-2021",
action: () => { self.delete() }
},
onChange: { // a trigger based event
notify: {
action: "email('i have changed')"
}
}
})
` },
{ name: "Custom Data Sources", header: 'Objects can live anywhere. Just map them. Build custom mappers or use existing ones', icon: 'feat-mapper.png', code: `OBJY.define({
name: "item",
pluralName: "items",
storage: OBJY.customStorage({
getById: () => {},
add: () => {},
remove: () => {}
}),
processor: OBJY.customProcessor({
...
}),
observer: OBJY.customObserver({
...
})
})
// Use your object wrapper for objects:
OBJY.item({
name: "hello"
})
` },
{ name: "Inherits", header: 'Inherits for reusing object structures', icon: 'feat-inheritance.png',code: `OBJY.object({
_id: 123, // <----
name: "template", // |
type: "whatever" // |
}) // | inherits by id
// |
OBJY.object({ // |
inherits: [123], // ------
_id: "xxxx",
name: "template",
type: "whatever"
})
` },
{ name: "More", header: 'Build whatever you like', icon: '', code: `OBJY.object({
onCreate: {
selfDestruct: {
action: () => {
obj.remove();
console.log('Im gone!')
}
}
}
})
`},
],
applications: [
/*{ name: "OBJY framework", details: 'OBJY can come very handy inside of many types of applications. For larger or smaller things', code: `
OBJY.object({
name: "Hi there",
type: "message",
onCreate: {
destroy: {
action: () => {
obj.remove()
}
}
}
})
`},*/
/*{ name: "Understand", details: 'Real life objects have characteristics, behaviour and can take actions. OBJY objects can do the same. This allows you to represent real use cases with OBJY.', html: '<span class="leto-text-xxl"><span class="fa fa-car"></span></span>', code: `
var OBJY = require('objy');
var OBJY_CATALOG = require('objy-catalog');
OBJY.define({
name: "item",
pluralName: "items",
storage: new OBJY_CATALOG.mappers.storage.mongoDB(...)
})
`},
*/
{ name: "Use in any JS Environment", html: '<span class="leto-text-xxl"><span class="fab fa-js"></span> <span class="fab fa-node"></span></span>', link: {label: 'Install now', url: 'docs/#/./DOCUMENTATION?id=installing'}, code: `
var OBJY = require('objy');
var OBJY_CATALOG = require('objy-catalog');
OBJY.define({
name: "item",
pluralName: "items",
storage: new OBJY_CATALOG.mappers.storage.mongoDB(...)
})
`},
{ name: "Build your own cloud platform", html: '<span class="leto-text-xxl"><span class="fa fa-cloud"></span></span>', link: {label: 'With SPOO', url: 'docs/#/./ECOSYSTEM?id=spoo-build-your-own-platform'}, code: `
var SPOO = require('spoojs');
var OBJY = require('objy');
OBJY.define({
name: "asset",
pluralName: "assets",
storage: new MongoMapper()
})
SPOO.REST({
OBJY: OBJY,
port: 80
}).run()
`},
{ name: "Learn OBJY", html: '<span class="leto-text-xxl"><span class="fa fa-lightbulb"></span></span>', link: {label: 'Read the docs now', url: 'docs/#/./DOCUMENTATION'}, code: `
var SPOO = require('spoojs');
var OBJY = require('objy');
OBJY.define({
name: "asset",
pluralName: "assets",
storage: new MongoMapper()
})
SPOO.REST({
OBJY: OBJY,
port: 80
}).run()
`},
]
}
})