Home Reference Source
import DataObject from 'potassium-es/src/DataObject.js'
public class | source

DataObject

Extends:

EventHandler → DataObject

Direct Subclass:

DataCollection, DataModel

The abstract class for DataModel and DataCollection It holds the event mixin and the generic function of fetching data from a remote service

Static Method Summary

Static Public Methods
public static

fetchAll(dataObjects: ...*): *

Fetch each DataObject and then wait for them all to return Note: this resolves when the fetches complete, regardless of whether they succeed or fail.

Constructor Summary

Public Constructor
public

constructor(options: Object)

Member Summary

Public Members
public
public get

fetchOptions: {"credentials": string}

public get

isNew: bool

public

options: *

public get

Method Summary

Public Methods
public
public

delete(): *

public

equals(obj: *): *

public

fetch(): *

public

onFirstReset(func: *)

public

parse(data: *): *

public

reset(data: {})

Clear out old data and set it to data, should trigger a 'reset' event

public

save(): *

Inherited Summary

From class EventHandler
public get

listeners: EventListener[]: *

public

addListener(callback: function(eventName: string, eventSource: EventHandler), eventName: Object | Symbol, once: bool)

public
public

removeListener(callback: *, eventName: undefined)

public

trigger(eventName: *, params: ...*)

Send an event to listeners

Static Public Methods

public static fetchAll(dataObjects: ...*): * source

Fetch each DataObject and then wait for them all to return Note: this resolves when the fetches complete, regardless of whether they succeed or fail.

Params:

NameTypeAttributeDescription
dataObjects ...*

Return:

*

Public Constructors

public constructor(options: Object) source

Params:

NameTypeAttributeDescription
options Object
  • optional
  • default: {}

Public Members

public cleanedUp: boolean source

public get fetchOptions: {"credentials": string} source

public get isNew: bool source

public options: * source

public get url: string source

Public Methods

public cleanup() source

public delete(): * source

Return:

*

public equals(obj: *): * source

Params:

NameTypeAttributeDescription
obj *

Return:

*

public fetch(): * source

Return:

*

public onFirstReset(func: *) source

Params:

NameTypeAttributeDescription
func *

public parse(data: *): * source

Params:

NameTypeAttributeDescription
data *

Return:

*

public reset(data: {}) source

Clear out old data and set it to data, should trigger a 'reset' event

Params:

NameTypeAttributeDescription
data {}
  • optional
  • default: {}

public save(): * source

Return:

*