<commit_before>﻿/// <reference path="tourabuex.ts" />
'use strict';

module TourabuEx.storage {
    var storageArea = chrome.storage.sync || chrome.storage.local;

    export function get(key: string, callback: Function) {
        storageArea.get(key, function (o) {
            if (!TourabuEx.util.isEmpty(o)) {
                callback(o[key]);
            } else {
                console.log('storage/key not forund: ' + key);
            }
        });
    }

    export function set(obj, callback?: Function) {
        storageArea.set(obj, callback || function () { });
    }

    export function remove(key: string, callback?: Function) {
        storageArea.remove(key, callback || function () {
            console.log('storage/removed', key);
        });<commit_msg>Fix a problem that module storage does not watching storage changing<commit_after>﻿/// <reference path="tourabuex.ts" />
'use strict';

module TourabuEx.storage {
    var storageArea = chrome.storage.sync || chrome.storage.local;

    chrome.storage.onChanged.addListener((o, n) => {
        events.trigger('storage/change', o);
    })

    export function get(key: string, callback: Function) {
        storageArea.get(key, function (o) {
            if (!TourabuEx.util.isEmpty(o)) {
                callback(o[key]);
            } else {
                console.log('storage/key not forund: ' + key);
            }
        });
    }

    export function set(obj, callback?: Function) {
        storageArea.set(obj, callback || function () { });
    }

    export function remove(key: string, callback?: Function) {
        storageArea.remove(key, callback || function () {
            console.log('storage/removed', key);
        });
{'fraction_non_alphanumeric': 0.14260666277030976, 'fraction_numerical': 0.0, 'mean_word_length': 2.317829457364341, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3576607', 'n_tokens_mistral': 492, 'n_tokens_neox': 473, 'n_words': 108}