@mongodb-js/charts-embed-dom
Version:
JavaScript library for embedding MongoDB Charts
44 lines (43 loc) • 1.5 kB
JavaScript
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getRealmUserToken = void 0;
const chart_1 = __importDefault(require("./chart"));
const dashboard_1 = __importDefault(require("./dashboard"));
const realm_auth_1 = require("./realm-auth");
Object.defineProperty(exports, "getRealmUserToken", { enumerable: true, get: function () { return realm_auth_1.getRealmUserToken; } });
/**
* Creates an instance of the embedding SDK
*/
class EmbedSDK {
/**
* Accepts an optional {@link EmbedChartOptions} object to use as the
* default options for any charts created using this SDK instance.
*
* ```js
* const sdk = new EmbedSDK({
* baseUrl: "https://charts.mongodb.com",
* })
* ```
*/
constructor(options) {
this.defaultOptions = options;
}
/**
* Creates a new {@link Chart} instance that allows you to
* interact with and embed charts into your application
*/
createChart(options) {
return new chart_1.default({ ...this.defaultOptions, ...options });
}
/**
* Creates a new {@link Dashboard} instance that allows you
* to embed a dashboard into your application
*/
createDashboard(options) {
return new dashboard_1.default({ ...this.defaultOptions, ...options });
}
}
exports.default = EmbedSDK;
;