mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-30 11:14:27 +08:00
Merge pull request #8698 from stpettersens/master
Type definitions and tests for electron-json-storage
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
/// <reference path="../github-electron/github-electron.d.ts" />
|
||||
/// <reference path="electron-json-storage.d.ts" />
|
||||
|
||||
import electron = require('electron');
|
||||
import storage = require('electron-json-storage');
|
||||
|
||||
storage.set("foo", { "foo": "bar" }, function(err: any) { });
|
||||
|
||||
storage.get("foo", function(err: any, data: Object) {
|
||||
console.log(JSON.stringify(data));
|
||||
});
|
||||
|
||||
storage.has("foo", function(err: any, hasKey: boolean) {
|
||||
console.log("hasKey?: %s", hasKey);
|
||||
});
|
||||
|
||||
storage.keys(function(err: any, keys: string[]) {
|
||||
console.log(keys);
|
||||
});
|
||||
|
||||
storage.remove("foo", function(err: any) {
|
||||
console.log(err);
|
||||
});
|
||||
|
||||
storage.clear(function(err: any) {
|
||||
console.log(err);
|
||||
});
|
||||
|
||||
storage.has("foo", function(err: any, data: Object) {
|
||||
console.log(data);
|
||||
});
|
||||
@@ -0,0 +1,13 @@
|
||||
// Type definitions for electron-json-storage
|
||||
// Project: https://github.com/jviotti/electron-json-storage
|
||||
// Definitions by: Sam Saint-Pettersen <https://github.com/stpettersens>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "electron-json-storage" {
|
||||
export function get(key: string, callback: (error: any, data: Object) => void): void;
|
||||
export function set(key: string, json: Object, callback: (error: any) => void): void;
|
||||
export function has(key: string, callback: (error: any, hasKey: boolean) => void): void;
|
||||
export function keys(callback: (error: any, keys: string[]) => void): void;
|
||||
export function remove(key: string, callback: (error: any) => void): void;
|
||||
export function clear(callback: (error: any) => void): void;
|
||||
}
|
||||
Reference in New Issue
Block a user