Avi Drissman | 4e1b7bc3 | 2022-09-15 14:03:50 | [diff] [blame^] | 1 | // Copyright 2019 The Chromium Authors |
Francois Doray | fd823bb1 | 2019-10-04 18:03:05 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. | ||||
4 | |||||
5 | 'use strict'; | ||||
6 | |||||
7 | self.onmessage = function(e) { | ||||
8 | // Acquire the lock. | ||||
9 | navigator.locks.request('worker_lock', {}, lock => { | ||||
10 | // Lock was acquired and will be released at the end of this scope. | ||||
11 | self.postMessage({rqid: e.data.rqid}); | ||||
12 | }); | ||||
13 | }; |