Nymph.js 1.0.0-beta.113
    Preparing search index...

    Interface DataObjectInterface

    Data Object interface.

    Objects which hold data from some type of storage.

    interface DataObjectInterface {
        $arraySearch(array: any[], strict?: boolean): number;
        $delete(): Promise<boolean>;
        $equals(object: any): boolean;
        $inArray(array: any[], strict?: boolean): boolean;
        $is(object: any): boolean;
        $patch(): Promise<boolean>;
        $refresh(): Promise<boolean | 0>;
        $save(): Promise<boolean>;
        [k: string]: any;
    }

    Hierarchy (View Summary)

    Indexable

    • [k: string]: any

      The object's data.

    Index

    Methods

    • Search the array for this object and return the corresponding index.

      If strict is false, is() is used to compare. If strict is true, equals() is used.

      Parameters

      • array: any[]

        The array to search.

      • Optionalstrict: boolean

        Whether to use stronger comparison.

      Returns number

      The index if the object is in the array, -1 if it isn't.

    • Delete the object from storage.

      Returns Promise<boolean>

      True on success, false on failure.

    • Perform a more strict comparison of this object to another.

      Parameters

      • object: any

        The object to compare.

      Returns boolean

      True or false.

    • Check whether this object is in an array.

      If strict is false, is() is used to compare. If strict is true, equals() is used.

      Parameters

      • array: any[]

        The array to search.

      • Optionalstrict: boolean

        Whether to use stronger comparison.

      Returns boolean

      True if the object is in the array, false if it isn't.

    • Perform a less strict comparison of this object to another.

      Parameters

      • object: any

        The object to compare.

      Returns boolean

      True or false.

    • Save the object's dirty data to storage.

      Returns Promise<boolean>

      True on success, false on failure.

    • Refresh the object from storage. (Bypasses Nymph's cache.)

      If the object has been deleted from storage, the database cannot be reached, or a database error occurs, refresh() will return 0.

      Returns Promise<boolean | 0>

      False if the data has not been saved, 0 if it can't be refreshed, true on success.

    • Save the object to storage.

      Returns Promise<boolean>

      True on success, false on failure.