forked from sfjs/sf.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
executable file
·50 lines (40 loc) · 1.7 KB
/
index.js
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
"use strict";
//https://github.com/spiral/sf.js
//Add console shim for old IE
require("./lib/shim/console");
var sf = {//Describe all modules to use it in plugins too.
modules: {
core: {
Ajax: require("./lib/core/Ajax"),
BaseDOMConstructor: require("./lib/core/BaseDOMConstructor"),
DomMutations:require("./lib/core/DomMutations"),
Events: require("./lib/core/Events"),
InstancesController: require("./lib/core/InstancesController")
},
helpers: {
DOMEvents:require("./lib/helpers/DOMEvents"),
domTools:require("./lib/helpers/domTools"),
LikeFormData: require("./lib/helpers/LikeFormData"),
tools: require("./lib/helpers/tools")
}
}
};
sf.instancesController = new sf.modules.core.InstancesController(sf);
sf.domMutation = new sf.modules.core.DomMutations(sf.instancesController);
//create global ajax
sf.ajax = new sf.modules.core.Ajax(window.csrfToken ? {//TODO move to spiral bindings
headers: {
"X-CSRF-Token": window.csrfToken
}
} : null);
window.spiral = sf; //TODO remove?
window.spiralFrontend = sf;
if (!window.hasOwnProperty("sf")){//bind only if window.sf is empty to avoid conflicts with other libs
window.sf = sf;
}
require("./lib/helpers/tools/iterateInputs.js"); //plugin is used in formMessages module to iterate form inputs
require("./lib/core/ajax/actions.js"); //plugin to perform actions from the server
require("./lib/vendor/formToObject"); //formToObject for form
require("./lib/instances/form/Form.js"); //add form
require("./lib/instances/form/formMessages"); //add form Messages handler
require("./lib/instances/lock/Lock.js"); //add lock