IntroductionInstallationLimitations of the "file" protocolFrequently asked questionsSyntax, keywords and built-in functionsStandard distributionimport implementationBrython packagesBrowser interface
Introduction - DOM API
Creating a document Accessing elements Attributes, properties and methods Events Mouse events Keyboard events Focus events Drag events Query string Interactions with Javascript Brython-specific built-in modules
browser
browser.aio browser.ajax browser.html browser.local_storage browser.markdown browser.object_storage browser.session_storage browser.svg browser.template browser.timer browser.webcomponent browser.websocket browser.worker Widgets browser.widgets.dialog browser.widgets.menu interpreter javascript Working with BrythonCookbook |
module browser.object_storageThis module extends local_storage and session_storage by allowing keys and values to be Python objects, not just strings. To achieve this, the object is serialised ; currently only JSON serializable objects are supported, such as as alist or dict . Also note that objects become immutable once
they are stored, so ObjecStorage()['foo'].update({"bar": "zoo"}) won't
actually do anything.
The module exposes a class:
ObjectStorage( storage)
returns an object store. storage is the
Example:
from browser.session_storage import storage from browser.object_storage import ObjectStorage object_storage = ObjectStorage(storage) object_storage[['do', 're', 'me']] = {"tune": "in tune"} # to update the value, need to copy out first tmp = object_storage[['do', 're', 'me']] tmp.update({"duration": "one hour"}) object_storage[['do', 're', 'me']] = tmp |