-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvr-hud.js
88 lines (74 loc) · 1.98 KB
/
vr-hud.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
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
(function(define){'use strict';define(function(require,exports,module){
/*jshint esnext:true*/
/*jshint node:true*/
/*globals define*/
/**
* Dependencies
*/
/**
* Locals
*/
var template = document.createElement('template');
template.innerHTML =
'<div>' +
'<content></content>' +
'</div>';
var baseComponents = window.COMPONENTS_BASE_URL || 'bower_components/';
/**
* Element prototype, extends from HTMLElement
*
* @type {Object}
*/
var proto = Object.create(HTMLElement.prototype);
function getStyle(className) {
var styleSheets = document.styleSheets;
var styleSheet;
var classes;
var i;
var j;
for (i=0; i<styleSheets.length; ++i) {
styleSheet = styleSheets[0];
classes = document.styleSheets[0].rules || document.styleSheets[0].cssRules;
for (j=0; j<classes.length; j++) {
if (classes[j].selectorText == className) {
return classes[j].style;
}
}
}
}
/**
* Called when the element is first created.
*
* Here we create the shadow-root and
* inject our template into it.
*
* @private
*/
proto.createdCallback = function() {
var tmpl = template.content.cloneNode(true);
var shadow = this.createShadowRoot();
this.inner = tmpl.firstElementChild;
shadow.appendChild(tmpl);
};
proto.render = function() {
var styleName = this.getAttribute('style');
};
proto.attachedCallback = function() {
console.log("Attached callback");
};
/**
* Called when one of the attributes
* on the element changes.
*
* @private
*/
proto.attributeChangedCallback = function(attr, oldVal, newVal) {
};
// Register and return the constructor
// and expose `protoype` (bug 1048339)
module.exports = document.registerElement('vr-hud', { prototype: proto });
module.exports._prototype = proto;
});})((function(n,w){'use strict';return typeof define=='function'&&define.amd?
define:typeof module=='object'?function(c){c(require,exports,module);}:
function(c){var m={exports:{}},r=function(n){return w[n];};
w[n]=c(r,m.exports,m)||m.exports;};})('vr-hud',this));