forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
UPDATE localForage type definitions (DefinitelyTyped#11702)
- Loading branch information
1 parent
e77a0d9
commit 2a5f017
Showing
2 changed files
with
75 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,86 @@ | ||
/// <reference path="localForage.d.ts" /> | ||
|
||
declare var localForage: LocalForage; | ||
declare let localForage: LocalForage; | ||
|
||
() => { | ||
namespace LocalForageTest { | ||
localForage.clear((err: any) => { | ||
var newError: any = err; | ||
let newError: any = err; | ||
}); | ||
|
||
localForage.iterate((str: string, key: string, num: number) => { | ||
var newStr: string = str; | ||
var newKey: string = key; | ||
var newNum: number = num; | ||
let newStr: string = str; | ||
let newKey: string = key; | ||
let newNum: number = num; | ||
}); | ||
|
||
localForage.length((err: any, num: number) => { | ||
var newError: any = err; | ||
var newNumber: number = num; | ||
let newError: any = err; | ||
let newNumber: number = num; | ||
}); | ||
|
||
localForage.key(0, (err: any, value: string) => { | ||
var newError: any = err; | ||
var newValue: string = value; | ||
let newError: any = err; | ||
let newValue: string = value; | ||
}); | ||
|
||
localForage.keys((err: any, keys: Array<string>) => { | ||
var newError: any = err; | ||
var newArray: Array<string> = keys; | ||
let newError: any = err; | ||
let newArray: Array<string> = keys; | ||
}); | ||
|
||
localForage.getItem("key",(err: any, str: string) => { | ||
var newError: any = err; | ||
var newStr: string = str | ||
let newError: any = err; | ||
let newStr: string = str | ||
}); | ||
|
||
localForage.getItem<string>("key").then((str: string) => { | ||
var newStr: string = str; | ||
let newStr: string = str; | ||
}); | ||
|
||
localForage.setItem("key", "value",(err: any, str: string) => { | ||
var newError: any = err; | ||
var newStr: string = str | ||
let newError: any = err; | ||
let newStr: string = str | ||
}); | ||
|
||
localForage.setItem("key", "value").then((str: string) => { | ||
var newStr: string = str; | ||
let newStr: string = str; | ||
}); | ||
|
||
localForage.removeItem("key",(err: any) => { | ||
var newError: any = err; | ||
let newError: any = err; | ||
}); | ||
|
||
localForage.removeItem("key").then(() => { | ||
}); | ||
|
||
var config = localForage.config({ | ||
name: "testyo", | ||
driver: localForage.LOCALSTORAGE | ||
}); | ||
|
||
var store = localForage.createInstance({ | ||
name: "da instance", | ||
driver: localForage.LOCALSTORAGE | ||
}); | ||
} | ||
|
||
{ | ||
let config: boolean; | ||
|
||
config = localForage.config({ | ||
name: "testyo", | ||
driver: localForage.LOCALSTORAGE | ||
}); | ||
} | ||
|
||
{ | ||
let store: LocalForage; | ||
|
||
store = localForage.createInstance({ | ||
name: "da instance", | ||
driver: localForage.LOCALSTORAGE | ||
}); | ||
} | ||
|
||
{ | ||
let testSerializer: LocalForageSerializer; | ||
|
||
localForage.getSerializer() | ||
.then((serializer: LocalForageSerializer) => { | ||
testSerializer = serializer; | ||
}); | ||
|
||
localForage.getSerializer((serializer: LocalForageSerializer) => { | ||
testSerializer = serializer; | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters