mirror of
https://github.com/gundb/panic-server.git
synced 2026-01-15 00:08:05 -05:00
Exposed a function named "test" that takes an options object, with things like how many gun requests to fire in total, what data to send, where to put it, what peers to connect to, etc... Exposed a Browser constructor that opens up a new window and runs the test function with the options provided, returning an interface to the window. Added a patch function to validate the option input and provide defaults where there aren't any values.
27 lines
491 B
JavaScript
27 lines
491 B
JavaScript
/*globals patch*/
|
|
var Browser;
|
|
(function () {
|
|
'use strict';
|
|
|
|
Browser = function (opt) {
|
|
if (!(this instanceof Browser)) {
|
|
return new Browser(opt);
|
|
}
|
|
var browser = this;
|
|
browser.opt = patch(opt);
|
|
browser.window = window.open('./', browser.opt.id);
|
|
browser.window.addEventListener('load', function () {
|
|
browser.window.test(browser.opt);
|
|
});
|
|
};
|
|
|
|
Browser.prototype = {
|
|
constructor: Browser,
|
|
close: function () {
|
|
this.window.close();
|
|
return this;
|
|
}
|
|
};
|
|
|
|
}());
|