Introducing SharedPrefs


#1

Hi everyone!

Last night I started working on an extension named SharedPrefs. It consists of previous things in the TinyDB component, but has just a few more. And many code improvements over the TinyDB component.

Documentation


Events

GotAllTags(tags) - A response to GetAllTags with a parameter of tags in which returns the tags listed in that namespace.
GotBoolean(tag, value) - A response to GetBoolean(tag, defaultValue) in which returns the given boolean value of the tag specified. If no value has corresponded to that tag, the given default value will be returned.
GotFloat(tag, value) - A response to GetFloat(tag, defaultValue) in which returns the given long value of the tag specified. If no value has corresponded to that tag, the given default value will be returned.
GotInt(tag, value) - A response to GetInt(tag, defaultValue) in which returns the given integer value to the tag specified. If no value has corresponded to that tag, the given default value will be returned.
GotLong(tag, value) - A response to GetLong(tag, defaultValue) in which returns the given long value of the tag specified. If no value has corresponded to that tag, the given default value will be returned.
GotNamespace(namespace) - A response to GetNamespace in which returns the current namespace applied.
GotString(tag, value) - A response to GetString(tag, defaultValue) in which returns the given string to the tag specified. If no value has corresponded to that tag, the given default value will be returned.
OnNamespaceChanged(oldNamespace, newNamespace) - A response when the namespace is changed in which returns the previous namespace before the new namespace has been applied.

Functions

GetAllTags - Gets all tags in the currently applied namespace, then throws a response to GotNamespace(namespace).
GetBoolean(tag, defaultValue) - Gets the boolean value corresponding to the tag specified, then throws the response to GotBoolean(tag, value). If no value is corresponded to as the specified tag, then it will instead throw the default value.
GetFloat(tag, defaultValue) - Gets the float value corresponding to the tag specified, then throws the response to GotFloat(tag, value). If no value is corresponded to as the specified tag, then it will instead throw the default value.
GetInt(tag, defaultValue) - Gets the integer value corresponding to the tag specified, then throws the response to GotInt(tag, value). If no value is corresponded to as the specified tag, then it will instead throw the default value.
GetLong(tag, defaultValue) - Gets the long value corresponding to the tag specified, then throws the response to GotLong(tag, value). If no value is corresponded to as the specified tag, then it will instead throw the default value.
GetNamespace - Gets the currently applied namespace at where all tags past the point where the namespace was set are being stored, then throws the response to GotNamespace(namespace).
GetString(tag, defaultValue) - Gets the string value corresponding to the tag specified, then throws the response to GotString(tag, value). If no value is corresponded to as the specified tag, then it will instead throw the default value.
PutBoolean(tag, value) - Saves the value to the corresponding tag in the currently applied namespace.
PutFloat(tag, value) - Saves the value to the corresponding tag in the currently applied namespace.
PutInt(tag, value) - Saves the value to the corresponding tag in the currently applied namespace.
PutLong(tag, value) - Saves the value to the corresponding tag in the currently applied namespace.
PutString(tag, value) - Saves the value to the corresponding tag in the currently applied namespace.
RemoveAllTags - Removes every tag from the currently applied namespace. Once this block is ran, there is no recovering the tags and values corresponding to the now deleted tags.
RemoveTag(tag) - Removes the specified tag from the currently applied namespace. Once this block is ran, there is no recovering the tag and value corresponding to that now deleted tag.
PutNamespace - Change the namespace, then throws a response to OnNamespaceChanged(oldNamespace, newNamespace).


Properties


PutNamespace - The namespace where as tags and values of those tags are stored, then throws a response to OnNamespaceChanged(oldNamespace, newNamespace) if it’s changed.


Screenshot

Download me

ml.sloth.sharedprefs.aix (8.9 KB)
BE CAUTIOUS! PACKAGE NAME CHANGE IS COMING SOON BECUASE I JUST NOTICED THAT DOMAIN IS TAKEN!

Want more?

Hungry for some more code? Remixes of current AI components? Ask, don’t just sit there!