RelativeTimeFormatConstructor.h 1022 B

12345678910111213141516171819202122232425262728293031323334
  1. /*
  2. * Copyright (c) 2022, Tim Flynn <trflynn89@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibJS/Runtime/NativeFunction.h>
  8. namespace JS::Intl {
  9. class RelativeTimeFormatConstructor final : public NativeFunction {
  10. JS_OBJECT(RelativeTimeFormatConstructor, NativeFunction);
  11. JS_DECLARE_ALLOCATOR(RelativeTimeFormatConstructor);
  12. public:
  13. virtual void initialize(Realm&) override;
  14. virtual ~RelativeTimeFormatConstructor() override = default;
  15. virtual ThrowCompletionOr<Value> call() override;
  16. virtual ThrowCompletionOr<NonnullGCPtr<Object>> construct(FunctionObject& new_target) override;
  17. private:
  18. explicit RelativeTimeFormatConstructor(Realm&);
  19. virtual bool has_constructor() const override { return true; }
  20. JS_DECLARE_NATIVE_FUNCTION(supported_locales_of);
  21. };
  22. ThrowCompletionOr<NonnullGCPtr<RelativeTimeFormat>> initialize_relative_time_format(VM& vm, RelativeTimeFormat& relative_time_format, Value locales_value, Value options_value);
  23. }