// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// https://github.com/inexorabletash/web-locks

callback LockGrantedCallback = any (Lock lock);
[
    SecureContext,
    Exposed=(Window,Worker),
    RuntimeEnabled=LocksAPI
] interface LockManager {
    [CallWith=ScriptState, RaisesException] Promise<Lock> acquire(
        DOMString name,
        LockGrantedCallback callback);
    [CallWith=ScriptState, RaisesException] Promise<Lock> acquire(
        DOMString name,
        LockOptions options,
        LockGrantedCallback callback);

    [CallWith=ScriptState, RaisesException] Promise<LockState> query();
};
