method listKeysWithPrefix

array listKeysWithPrefix(string keyPrefix);

Argumente

Zurückgegebener Wert

This method lists keys from the key-value store. The key names are returned in an array that match the keyPrefix argument. For example, if foo.bar.baz and foo.bar.sna.dig keys exist in the key-value store, and if the keyPrefix was foo, then two array entries foo.bar.baz and foo.bar.sna.dig would be returned.

The preferred method of implementing key hierarchies is to use dictionaries as values for a key.

The following example will get the keys for an away message.
var factory = shell.serviceManager.localStorage.factory;
if (factory)
{
    var keyValueStore = factory.createKeyDatabaseForIdentity("johndoe", "aol.mail");
    if (keyValueStore)
    {
        keyValueStore.setValueForKey("awayMessage.1.name", "Meeting");
        keyValueStore.setValueForKey("awayMessage.1.message", "In a meeting.");
        keyValueStore.setValueForKey("awayMessage.1.default", false);
        var keys = keyValueStore.listKeysWithPrefix("awayMessage.1");
    }
}