lix-website/themes/lix/assets/bootstrap/node_modules/browserstack/lib/screenshot.js

49 lines
908 B
JavaScript
Raw Normal View History

2024-04-27 03:39:10 +00:00
var util = require("util");
var BaseClient = require("./client");
var extend = require("./extend");
function ScreenshotClient(settings) {
this.server = {
host: "www.browserstack.com"
};
BaseClient.call(this, settings);
}
util.inherits(ScreenshotClient, BaseClient);
// public API
extend(ScreenshotClient.prototype, {
getBrowsers: function(fn) {
this.request({
path: this.path("/browsers.json")
}, fn);
},
generateScreenshots: function(options, fn) {
var data = JSON.stringify(options);
this.request({
method: "POST",
path: this.path("")
}, data, fn);
},
getJob: function(id, fn) {
this.request({
path: this.path("/" + id + ".json")
}, fn);
}
});
// internal API
extend(ScreenshotClient.prototype, {
path: function(path) {
return "/screenshots" + path;
}
});
module.exports = {
createClient: function(settings) {
return new ScreenshotClient(settings);
}
};