@secrecy/lib
    Preparing search index...

    Interface StoreBuddyInit<T>

    interface StoreBuddyInit<T> {
        init: (data: IsEmptyObject<T>) => StoreBuddy<T>;
    }

    Type Parameters

    • T
    Index
    init: (data: IsEmptyObject<T>) => StoreBuddy<T>

    Initialise the storeBuddy instance with 'default' (first-load) data. This behaves in the same way as the save method in the main StoreBuddy interface but doesn't save any data if the storage entry already exists (to prevent new data being overwritten by its older, default form).

    Type Declaration

    import storeBuddy from "store-buddy";

    // The "foo" entry is initialised with the default data "bar"
    const storage1 = storeBuddy("foo").init("bar");

    // The "hello" entry is initialised with a default object literal
    const storage2 = storeBuddy("hello").init({ prop1: "world", prop2: false });