@jameslnewell/buildkite-pipelines
Version:
Generate Buildkite pipelines from code.
56 lines (55 loc) • 1.83 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "NotificationHelper", {
enumerable: true,
get: function() {
return NotificationHelper;
}
});
function _check_private_redeclaration(obj, privateCollection) {
if (privateCollection.has(obj)) {
throw new TypeError("Cannot initialize the same private elements twice on an object");
}
}
function _class_apply_descriptor_get(receiver, descriptor) {
if (descriptor.get) {
return descriptor.get.call(receiver);
}
return descriptor.value;
}
function _class_extract_field_descriptor(receiver, privateMap, action) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to " + action + " private field on non-instance");
}
return privateMap.get(receiver);
}
function _class_private_field_get(receiver, privateMap) {
var descriptor = _class_extract_field_descriptor(receiver, privateMap, "get");
return _class_apply_descriptor_get(receiver, descriptor);
}
function _class_private_field_init(obj, privateMap, value) {
_check_private_redeclaration(obj, privateMap);
privateMap.set(obj, value);
}
var _notifications = /*#__PURE__*/ new WeakMap();
class NotificationHelper {
/**
* @see https://buildkite.com/docs/pipelines/notifications
*/ addNotification(notification) {
_class_private_field_get(this, _notifications).push(notification);
}
build() {
return _class_private_field_get(this, _notifications).length > 0 ? {
notify: _class_private_field_get(this, _notifications)
} : {};
}
constructor(){
_class_private_field_init(this, _notifications, {
writable: true,
value: []
});
}
}
//# sourceMappingURL=notifification.js.map