Error provider
This commit is contained in:
@@ -1,31 +1,45 @@
|
||||
(function(){
|
||||
"use strict";
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
window._stateSet = function () {
|
||||
window._stateSet = function() {
|
||||
console.log("Call _stateSet only once");
|
||||
window._stateSet = function () {
|
||||
console.log('Call _stateSet only once');
|
||||
};
|
||||
let appState = window._appState;
|
||||
|
||||
let btn = document.getElementById('token');
|
||||
btn.addEventListener('click', function() {
|
||||
btn.addEventListener('click', function () {
|
||||
appState.onTokenReceived('token123');
|
||||
})
|
||||
});
|
||||
|
||||
let colorChangeBtnRed = document.getElementById('colorChangeBtnRed');
|
||||
colorChangeBtnRed.addEventListener('click', function() {
|
||||
var hexColor = '#FF0000'.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i
|
||||
, (m, r, g, b) => '#ff' + r + r + g + g + b + b).substring(1);
|
||||
colorChangeBtnRed.addEventListener('click', function () {
|
||||
var hexColor = '#FF0000'
|
||||
.replace(
|
||||
/^#?([a-f\d])([a-f\d])([a-f\d])$/i,
|
||||
(m, r, g, b) => '#ff' + r + r + g + g + b + b
|
||||
)
|
||||
.substring(1);
|
||||
var numColor = parseInt(hexColor, 16);
|
||||
appState.changeColor(numColor)
|
||||
})
|
||||
|
||||
appState.changeColor(numColor);
|
||||
});
|
||||
|
||||
let colorChangeBtnBlue = document.getElementById('colorChangeBtnBlue');
|
||||
colorChangeBtnBlue.addEventListener('click', function() {
|
||||
var hexColor = '#0000FF'.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i
|
||||
, (m, r, g, b) => '#ff' + r + r + g + g + b + b).substring(1);
|
||||
colorChangeBtnBlue.addEventListener('click', function () {
|
||||
var hexColor = '#0000FF'
|
||||
.replace(
|
||||
/^#?([a-f\d])([a-f\d])([a-f\d])$/i,
|
||||
(m, r, g, b) => '#ff' + r + r + g + g + b + b
|
||||
)
|
||||
.substring(1);
|
||||
var numColor = parseInt(hexColor, 16);
|
||||
appState.changeColor(numColor)
|
||||
})
|
||||
}
|
||||
}());
|
||||
appState.changeColor(numColor);
|
||||
});
|
||||
|
||||
function onError() {
|
||||
console.error('aboba');
|
||||
}
|
||||
|
||||
appState.setOnError(onError);
|
||||
};
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user