1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19

content / test / data / shared_storage / getter_module.js [blame]

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


class GetOperation {
  async run(data) {
    console.log(`sharedStorage.length(): ` + await sharedStorage.length());
    if (data && data.hasOwnProperty('key')) {
      console.log(
          `sharedStorage.get('${data['key']}'): ` +
          await sharedStorage.get(data['key']));
    } else {
      console.log('No `data`, or `data` does not have `key`.');
    }
  }
}

register('get-operation', GetOperation);