discourse/app/assets/javascripts/float-kit/addon/lib/d-toast-instance.js

23 lines
516 B
JavaScript

import { setOwner } from "@ember/application";
import { action } from "@ember/object";
import { inject as 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);
}
}