-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
59 lines (42 loc) · 1.17 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
51
52
53
54
55
56
57
58
59
'use strict';
var util = require('util');
var assert = require('assert');
var Pak = require('pak');
var assign = require('lodash/object/assign');
var ui = require('./lib/ui');
var board = require('./lib/board');
function asyncNoop(cb){
process.nextTick(cb);
}
function layoutNoop(el, cb){
asyncNoop(cb);
}
function generateContainer(){
var container = document.createElement('div');
container.style.width = '100%';
container.style.height = '100%';
container.style.margin = 0;
container.style.padding = 0;
document.body.insertBefore(container, document.body.firstChild);
return container;
}
function Irken(opts){
opts = opts || {};
Pak.call(this);
this.lifecycle = {};
this.mountpoints = {};
this.mountpointElements = {};
//board manager init
this._boards = {};
this._devices = {};
this._renderCalled = false;
this._container = opts.container || generateContainer();
this.layout(layoutNoop);
}
util.inherits(Irken, Pak);
Irken.prototype.expose = function expose(namespace, exposed){
assert(!this[namespace], namespace + ' is already defined');
this[namespace] = exposed;
};
assign(Irken.prototype, ui, board);
module.exports = Irken;