@trimble-oss/trimble-id
Version:
Trimble Identity SDK for JavaScript/ TypeScript
54 lines (50 loc) • 1.75 kB
JavaScript
(function (root, factory) {
/* istanbul ignore next */
if (typeof define === 'function' && define.amd) {
// AMD
define(['./AnalyticsHttpClient'], (AnalyticsHttpClient) => {
return factory({
AnalyticsHttpClient: AnalyticsHttpClient,
});
});
} else if (typeof exports === 'object') {
// CommonJS
module.exports = factory({
AnalyticsHttpClient: require('./AnalyticsHttpClient'),
});
} else {
// Browser globals (Note: root is window)
root.FixedKeysetProvider = factory(root);
}
}(this, function (imports) {
/**
* @implements {IKeysetProvider}
* @description FixedKeysetProvider helps to return a fixed key set
*/
class FixedKeysetProvider {
/**
* @description Public constructor for FixedKeySetProvider class
* @param {any} keyset A dictionary of named keys
*/
constructor(keyset) {
this._keyset = keyset;
//Send analytics
this._analyticshttpclient = imports.AnalyticsHttpClient;
this._analyticshttpclient.sendInitEvent(this.constructor.name);
}
/**
* @description Retrieves an dictionary of named keys
* @returns {PromiseLike<any>} A Task that resolves to a dictionary of named keys on completion
*/
RetrieveKeyset() {
//Send analytics
this._analyticshttpclient.sendMethodEvent(this.RetrieveKeyset.name);
var _this = this;
return new Promise((resolve, reject) => {
resolve(_this._keyset);
});
}
}
// Exposed public methods
return FixedKeysetProvider;
}));