UNPKG

2.84 kBJavaScriptView Raw
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6/**
7 * The {@codelink Storage} is an unordered collection of named values of any
8 * type. Values in the storage are named using {@code string} keys. The storage
9 * can be therefore thought of as a {@code Map<string, *>}.
10 *
11 * @interface
12 */
13class Storage {
14 /**
15 * This method is used to finalize the initialization of the storage after
16 * the dependencies provided through the constructor have been prepared for
17 * use.
18 *
19 * This method must be invoked only once and it must be the first method
20 * invoked on this instance.
21 *
22 * @return {Storage} This storage.
23 */
24 init() {}
25
26 /**
27 * Returns {@code true} if the entry identified by the specified key exists
28 * in this storage.
29 *
30 * @param {string} key The key identifying the storage entry.
31 * @return {boolean} {@code true} if the storage entry exists.
32 */
33 has() {}
34
35 /**
36 * Retrieves the value of the entry identified by the specified . The
37 * method returns {@code undefined} if the entry does not exists.
38 *
39 * Entries set to the {@code undefined} value can be tested for existence
40 * using the {@codelink has} method.
41 *
42 * @param {string} key The key identifying the storage entry.
43 * @return {*} The value of the storage entry.
44 */
45 get() {}
46
47 /**
48 * Sets the storage entry identified by the specified key to the provided
49 * value. The method creates the entry if it does not exist already.
50 *
51 * @param {string} key The key identifying the storage entry.
52 * @param {*} value The storage entry value.
53 * @return {Storage} This storage.
54 */
55 set() {}
56
57 /**
58 * Deletes the entry identified by the specified key from this storage.
59 *
60 * @param {string} key The key identifying the storage entry.
61 * @return {Storage} This storage.
62 */
63 delete() {}
64
65 /**
66 * Clears the storage of all entries.
67 *
68 * @return {Storage} This storage.
69 */
70 clear() {}
71
72 /**
73 * Returns an iterator for traversing the keys in this storage. The order
74 * in which the keys are traversed is undefined.
75 *
76 * @return {Iterator<string>} An iterator for traversing the keys in this
77 * storage. The iterator also implements the iterable protocol,
78 * returning itself as its own iterator, allowing it to be used in
79 * a {@code for..of} loop.
80 */
81 keys() {}
82
83 /**
84 * Returns the number of entries in this storage.
85 *
86 * @return {number} The number of entries in this storage.
87 */
88 size() {}
89}
90exports.default = Storage;
91
92typeof $IMA !== 'undefined' && $IMA !== null && $IMA.Loader && $IMA.Loader.register('ima/storage/Storage', [], function (_export, _context) {
93 'use strict';
94 return {
95 setters: [],
96 execute: function () {
97 _export('default', exports.default);
98 }
99 };
100});