discourse/app/assets/javascripts/float-kit/addon/lib/d-toast-instance.js
2024-03-06 18:05:11 +01:00

23 lines
506 B
JavaScript

import { setOwner } from "@ember/application";
import { action } from "@ember/object";
import { service } from "@ember/service";
import uniqueId from "discourse/helpers/unique-id";
import { TOAST } from "float-kit/lib/constants";
export default class DToastInstance {
@service toasts;
options = null;
id = uniqueId();
constructor(owner, options = {}) {
setOwner(this, owner);
this.options = { ...TOAST.options, ...options };
}
@action
close() {
this.toasts.close(this);
}
}