Skip to content

Conversation

@uelarn
Copy link

@uelarn uelarn commented Oct 11, 2015

Used in application with the Aurelia framework using jspm package manager with system.js module loader.

Application code written in Typescript.

Use case:

import {localStorageDB} from "localStorageDB";

const OPENTAGS = "OpenTags";

export interface IOpenTagsRow {
    ID: number,
    TagID: number
}

export class LocalstorServices {
    private _lsdb: localStorageDB;


    constructor() {
        this._lsdb = new localStorageDB("MyToolBoxStore", "localStorage");
        if (!this._lsdb.tableExists(OPENTAGS)) {
            this._lsdb.createTable(OPENTAGS, ["TagID"]);
            this._lsdb.commit();
        }

    }

    getAllTagTreeState(): IOpenTagsRow[] {
        return this._lsdb.queryAll(OPENTAGS) as IOpenTagsRow[];
    }

    deleteTagTreeState(tagid: number) {
        this._lsdb.deleteRows(OPENTAGS, { TagID: tagid });
        this._lsdb.commit();
    }

    addTagTreeState(tagid: number) {
        this._lsdb.insert(OPENTAGS, { TagID: tagid });
        this._lsdb.commit();
    }
}

return insert(table_name, validateData(table_name, data));
} else {
var ids = [];
for (var n = 0; n < result_ids.length; n++) {
Copy link
Contributor

@w35l3y w35l3y Apr 30, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing #68 here.

I didn't get the idea of having localstoragedb.js duplicated.
Is it really necessary?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants