ts/service/LocalStorageService.ts:39
The LocalStorageService...
_listeners
Any
protected
Inherited from
EventDispatcher:
ts/event/EventDispatcher.ts:26
Holds a reference to added listeners.
_localStorage
Storage
protected
Defined in
ts/service/LocalStorageService.ts:69
A reference to window.localStorage for faster access.
_namespace
String
protected
Defined in
ts/service/LocalStorageService.ts:58
Current user namespace. The namespace is optional.
Default: defaultNamespace
isEnabled
Boolean
public
Inherited from
ObjectManager:
ts/ObjectManager.ts:17
The isEnabled property is used to keep track of the enabled state of the object.
Default: false
parent
Any
public
Inherited from
EventDispatcher:
ts/event/EventDispatcher.ts:35
Indicates the object that contains a child object. Uses the parent property to specify a relative path to display objects that are above the current display object in the display list hierarchy and helps facilitate event bubbling.
sjsId
Int
public
Inherited from
BaseObject:
ts/BaseObject.ts:15
The sjsId (StructureJS ID) is a unique identifier automatically assigned to most StructureJS objects upon instantiation.
Default: null
There are no properties that match your current filter settings. You can change your filter settings in the index section on this page. index
LocalStorageService
()
Defined in
ts/service/LocalStorageService.ts:39
this._localStorageController = new LocalStorageService();
this._localStorageController.set('someName', { value: 'something'});
_onLocalStorageEvent
event
Defined in
ts/service/LocalStorageService.ts:303
event
StorageEvent
The native browser event for Web Storage.
addEventListener
type
callback
scope
[priority=0]
Inherited from
EventDispatcher:
ts/event/EventDispatcher.ts:51
Registers an event listener object with an EventDispatcher object so the listener receives notification of an event.
type
String
The type of event.
callback
Function
The listener function that processes the event. This function must accept an Event object as its only parameter and must return nothing, as this example shows. @example function(event:Event):void
scope
Any
Binds the scope to a particular object (scope is basically what "this" refers to in your function). This can be very useful in JavaScript because scope isn't generally maintained.
[priority=0]
Int
optional
Influences the order in which the listeners are called. Listeners with lower priorities are called after ones with higher priorities.
this.addEventListener(BaseEvent.CHANGE, this._handlerMethod, this);
_handlerMethod(event) {
console.log(event.target + " sent the event.");
console.log(event.type, event.data);
}
addEventListenerOnce
type
callback
scope
[priority=0]
Inherited from
EventDispatcher:
ts/event/EventDispatcher.ts:100
Registers an event listener object once with an EventDispatcher object so the listener will receive the notification of an event.
type
String
The type of event.
callback
Function
The listener function that processes the event. This function must accept an Event object as its only parameter and must return nothing, as this example shows. @example function(event:Event):void
scope
Any
Binds the scope to a particular object (scope is basically what "this" refers to in your function). This can be very useful in JavaScript because scope isn't generally maintained.
[priority=0]
Int
optional
Influences the order in which the listeners are called. Listeners with lower priorities are called after ones with higher priorities.
this.addEventListenerOnce(BaseEvent.CHANGE, this._handlerMethod, this);
_handlerMethod(event) {
console.log(event.target + " sent the event.");
console.log(event.type, event.data);
}
destroy
()
Void
public
Inherited from
BaseObject:
ts/BaseObject.ts:49
The purpose of the destroy method is to make an object ready for garbage collection. This should be thought of as a one way function. Once destroy is called no further methods should be called on the object or properties accessed. It is the responsibility of those who implement this function to stop all running Timers, all running Sounds, and take any other steps necessary to make an object eligible for garbage collection.
By default the destroy method will null out all properties of the class automatically. You should call destroy on other objects before calling the super.
destroy() {
this.disable();
this._childInstance.destroy();
super.destroy();
}
disable
()
public
chainable
Inherited from
ObjectManager:
ts/ObjectManager.ts:60
The disable method is responsible for disabling event listeners and/or children of the containing objects.
disable() {
if (this.isEnabled === false) { return; }
this._childInstance.removeEventListener(BaseEvent.CHANGE, this.handlerMethod, this);
this._childInstance.disable();
super.disable();
}
dispatchEvent
event
[data=null]
Inherited from
EventDispatcher:
ts/event/EventDispatcher.ts:167
Dispatches an event into the event flow. The event target is the EventDispatcher object upon which the dispatchEvent() method is called.
event
String | BaseEvent
The Event object or event type string you want to dispatch. You can create custom events, the only requirement is all events must extend BaseEvent.
[data=null]
Any
optional
The optional data you want to send with the event. Do not use this parameter if you are passing in a BaseEvent.
this.dispatchEvent('change');
// Example: Sending data with the event:
this.dispatchEvent('change', {some: 'data'});
// Example: With an event object
// (event type, bubbling set to true, cancelable set to true and passing data) :
let event = new BaseEvent(BaseEvent.CHANGE, true, true, {some: 'data'});
this.dispatchEvent(event);
// Here is a common inline event object being dispatched:
this.dispatchEvent(new BaseEvent(BaseEvent.CHANGE));
enable
()
public
chainable
Inherited from
ObjectManager:
ts/ObjectManager.ts:32
The enable method is responsible for enabling event listeners and/or children of the containing objects.
enable() {
if (this.isEnabled === true) { return; }
this._childInstance.addEventListener(BaseEvent.CHANGE, this.handlerMethod, this);
this._childInstance.enable();
super.enable();
}
get
key
[useNamespace=false]
Defined in
ts/service/LocalStorageService.ts:161
getAll
[namespace=null]
Defined in
ts/service/LocalStorageService.ts:195
Returns all items in local storage as an Object with key and value properties or returns all items with a certain namespace.
[namespace=null]
String
optional
The namespace that is used to items.
this._localStorageController.getAll();
this._localStorageController.getAll('myNamespace~');
getEventListeners
()
ArrayInherited from
EventDispatcher:
ts/event/EventDispatcher.ts:284
Returns and array of all current event types and there current listeners.
this.getEventListeners();
getLength
()
Number
Defined in
ts/service/LocalStorageService.ts:259
Returns the number of items storage in local storage.
const numberOfItemsInLocalStorage = this._localStorageController.getLength();
getNamespace
()
String
Defined in
ts/service/LocalStorageService.ts:109
Get storage namespace
const currentSetNamespace = this._localStorageController.getNamespace();
getQualifiedClassName
()
String
public
Inherited from
BaseObject:
ts/BaseObject.ts:32
Returns the fully qualified class name of an object.
Returns the class name.
let someClass = new SomeClass();
someClass.getQualifiedClassName();
// SomeClass
getSize
()
Number
Defined in
ts/service/LocalStorageService.ts:272
Returns the size of the Local Storage.
const sizeOfLocalStorage = this._localStorageController.getSize();
hasEventListener
type
callback
scope
Inherited from
EventDispatcher:
ts/event/EventDispatcher.ts:253
print
()
String
public
Inherited from
EventDispatcher:
ts/event/EventDispatcher.ts:298
Prints out each event listener in the console.log
this.printEventListeners();
// [ClassName] is listening for the 'BaseEvent.change' event.
// [AnotherClassName] is listening for the 'BaseEvent.refresh' event.
remove
key
[useNamespace=false]
Defined in
ts/service/LocalStorageService.ts:228
Deletes a key/value pair from the Local Storage collection.
this._localStorageController.remove('someName');
// If you set a namespace you would pass 'true' into the second parameter.
this._localStorageController.remove('someName', true);
removeAll
[namespace=null]
Defined in
ts/service/LocalStorageService.ts:285
Removes all key/value pairs from the Local Storage area.
[namespace=null]
String
optional
this._localStorageController.removeAll();
this._localStorageController.removeAll('myNamespace~');
removeEventListener
type
callback
scope
Inherited from
EventDispatcher:
ts/event/EventDispatcher.ts:133
removeItemsWithNamespace
namespace
Defined in
ts/service/LocalStorageService.ts:313
Deletes all key/value pairs with a certain namespace.
namespace
String
set
key
data
[useNamespace=false]
Defined in
ts/service/LocalStorageService.ts:122
Add a key/value pair to localStorage.
this._localStorageController.set('someName', { value: 'something'});
// If you set a namespace you would pass 'true' into the third parameter.
this._localStorageController.set('someName', { value: 'something'}, true);
setNamespace
namespace
Defined in
ts/service/LocalStorageService.ts:95
There are no methods that match your current filter settings. You can change your filter settings in the index section on this page. index