// ------------------------------------------------------------------------------------------
// LacunaWebPKI.configure example
// In this example, we'll be using the configure method to change the initially configured
// default error callback (the actual call to the configure method is in the bottom of the code,
// in the onChangeCallback function).
// This is the callback that will be initially configured
function errorCallback1(message, error, origin) {
log('errorCallback1 called! Now try changing the default error callback.');
}
// This is the callback that will be later configured
function errorCallback2(message, error, origin) {
log('errorCallback2 called!');
}
// We instantiate a LacunaWebPKI object passing a reference to errorCallback1 as the default error callback
var myLicense = {
"format": 1,
"allowedDomains": [
"jsfiddle.net",
"webpki.lacunasoftware.com"
],
"expiration": null,
"signature": "ClKvO1J22vAD+YmfANiKQLbcLE1lNraPKCel6tRM+ZxR+h6M/crtJYRRVGGz7hrdbM0Y0mfTu15RMYGqQMi1QNZS6GrT4vNzIayv552Fl0EFWQA7jWlctUwfYoHRHVEnCNx9YGXDiA9+yDoGlVwgTR7fjzNeS3Fen1MVIyKBF464gN0JvdiCRJMI47JGVDkPmKjcrYIvJs6y5Lg25RW4ZnBKVruS+HR2s3k8ZrV4y4RCQE4UYMKbukF9vsF+JqAEifRlPq2xLcrNdxBveVDSXS/LRHAcrZrMM+Iw4A79jl0ngWPcy+CwinAhT+3dxVo5ZWMRQFpmTkylEMDvTjV9wQ=="
};
var pki = new LacunaWebPKI({
license: myLicense,
defaultError: errorCallback1 // <-- here's the reference
});
// When the Start button is called, we'll run the component verification. If all is OK, we'll enable
// the other buttons
function onStart() {
log('Checking component installation ...');
pki.checkInstalled({
installed: function() {
log('Component detected. Now try causing an error.');
$("#forceErrorButton").removeAttr("disabled");
$("#changeCallbackButton").removeAttr("disabled");
},
notInstalled: function(status, message) {
log(message);
}
});
}
// When the...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.