From 12b79812d6cdff92d863c07f78dce39b57a73772 Mon Sep 17 00:00:00 2001 From: YuichiNukiyama Date: Sun, 17 May 2015 09:45:40 +0000 Subject: [PATCH 1/7] Update localForage to 1.2 localForage has been Changed since last year.So, I update localforage.d.ts to 1.3. --- localForage/localForage-tests.ts | 86 +++++++++++++++++++++---------- localForage/localForage.d.ts | Bin 834 -> 4444 bytes 2 files changed, 60 insertions(+), 26 deletions(-) diff --git a/localForage/localForage-tests.ts b/localForage/localForage-tests.ts index f1a416dcf..5267dc798 100644 --- a/localForage/localForage-tests.ts +++ b/localForage/localForage-tests.ts @@ -1,34 +1,68 @@ /// -declare var localForage: lf.ILocalForage -declare var callback: lf.ICallback -declare var promise: lf.IPromise +declare var localForage: lf.ILocalForage; +declare var callback: lf.ICallback; +declare var iterateCallback: lf.IIterateCallback; +declare var errorCallback: lf.IErrorCallback; +declare var keyCallback: lf.IKeyCallback; +declare var keysCallback: lf.IKeysCallback; +declare var numberCallback: lf.INumberCallback; +declare var promise: lf.IPromise; () => { - localForage.clear() - localForage.length - localForage.key(0) + localForage.clear((err: any) => { + var newError: any = err; + }); + + localforage.iterate((str: string, key: string, num: number) => { + var newStr: string = str; + var newKey: string = key; + var newNum: number = num; + }); + + localForage.length((err: any, num: number) => { + var newError: any = err; + var newNumber: number = num; + }); + + localForage.key(0,(err: any, value: string) => { + var newError: any = err; + var newValue: string = value; + }); + + localforage.keys((err: any, keys: Array) => { + var newError: any = err; + var newArray: Array = keys; + }); + + localForage.getItem("key",(err: any, str: string) => { + var newError: any = err; + var newStr: string = str + }); + + localForage.getItem("key").then((err: any, str: string) => { + var newError: any = err; + var newStr: string = str + }); - localForage.getItem("key", (str: string) => { - var newStr: string = str - }) - localForage.getItem("key").then((str: string) => { - var newStr: string = str - }) + localForage.setItem("key", "value",(err: any, str: string) => { + var newError: any = err; + var newStr: string = str + }); + + localForage.setItem("key", "value").then((err: any, str: string) => { + var newError: any = err; + var newStr: string = str; + }); - localForage.setItem("key", "value", (str: string) => { - var newStr: string = str - }) - localForage.setItem("key", "value").then((str: string) => { - var newStr: string = str - }) + localForage.removeItem("key",(err: any) => { + var newError: any = err; + }); + + localForage.removeItem("key").then((err: any, str: string) => { + var newError: any = err; + var newStr: string = str + }); - localForage.removeItem("key", (str: string) => { - var newStr: string = str - }) - localForage.removeItem("key").then((str: string) => { - var newStr: string = str - }) - - promise.then(callback) + promise.then(callback); } diff --git a/localForage/localForage.d.ts b/localForage/localForage.d.ts index c3d0371d005f4eb662bc972e63364bf9e0796eff..6cef3a9ea7ee22b54b15c43b5f6dff793ce9b361 100644 GIT binary patch literal 4444 zcmb_fU2oGs5ZoUE(!G%&REtjus45{SC@K_G`og1=IBmdjB0DV&sDB-px%KrN$5-qo zirhP&?c3Se+1=~kKaoUYkm;}Z4?-0__=YwKJtWGH)hYc4aa&M+^17&LOQpDQGZ@g(R@<%l&I}=zM*|!Gr@g^SCsPDtp0lukz@Air0 zA%1>ew{Ea%vE#&QX@-?0qNI9_F^{2~*v6Cm)2k)?$$^{L z&#*={^Q$@j#<+&of3jxq9komk_X6mmhIKNS;JaLU;DqW=Es7ELWE2N-h-cJ(E^lkk z`}U1XJfk8v8M&RQfyJ7am`%wUvr|zRFvr;i@I^P=EwDBP7II5gG$+U%wNI4Y{3oN# z7-gs*eo#nBioJx@PR1nw(}>6Ika|CFEy-Eb5{K z-LY5hJiuPeu`3(p3~`u28RUlQY}U#Vp09SSlR6hEV#HW`E~r_@hu1|tx9+A7<)jE^ zhk9K6$LH6bvqQb6H_nf01f1^$uCE6fn8#`|vI$rP$!mUyMyGpquvG2G$4 z>37mi_1jPtVgGRYsb|bCa)nH>f2dEa!R+>|Th%)2c+jqEEJH(^{aT^91M{c=+68`O zQ0us3mi2{C(=tC@C9dZ~DDRk+%wV^lMvzr(URug9qq>=Ss&wWX&mv2F%W5@44EtF7 ziRY^QYOgTxf%wu+F|6;exLEJV89Ox95zhR2Oxsn#c2-p%1JN_s%(9Y5X~FpZtFzm? z&R3|!^=6)?*g1ShrGCP>6N+h5U*)N+8m};)zRQvA)17mCcO<*y{lx0lpNpLSz4xxB zReRfJ2Ja?1%ole`^EnlcQ9Zl2JsEYe-!2N*=rH~S#%$d@>o(_T^C`CnhIsCyr>u%A zt4kj()oQ46w?Wh96cxf&$HBT3j^4E7g4wSB3s$=kJ*oEAZG1YkoHd=5L!Q)G-p2Y7 zVzznuYHQhZc#Meiv`J>F)xQsoxoX=c!is0}Y}6eQ|Hn4+#22k3^~kX7Sf m&x$VSs=E1%zV1BUrKXy?UNc6mshNb%V0BM#@6n9#wfqC2gQyw+ literal 834 zcmbV}-AcqT5QXpi6mw?R4i*!7m)qIZY<_cbJzoyiiO!^bX`S>v zGi%$Cu@_Z8#1mO2kSpd8v=yyFP!+sp5RWv`yP%TFnER*F3} zysoj&r4hKLU|LmrlJPZ#;&!~o4}A8U zKx0c07ow%d2pmlOlu5@_i}8nlwfj-z8)JvscKF|b)AWSZF55>w! T$*=5jfC(BJH2Lp)*=4&o+j9m8 From 33cc02c18267117df0978f2b18e3a131bbf75e40 Mon Sep 17 00:00:00 2001 From: YuichiNukiyama Date: Sun, 17 May 2015 10:10:13 +0000 Subject: [PATCH 2/7] modified a few bug --- localForage/localForage-tests.ts | 4 ++-- localForage/localForage.d.ts | Bin 4444 -> 4468 bytes 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/localForage/localForage-tests.ts b/localForage/localForage-tests.ts index 5267dc798..1e1ab4dd5 100644 --- a/localForage/localForage-tests.ts +++ b/localForage/localForage-tests.ts @@ -14,7 +14,7 @@ declare var promise: lf.IPromise; var newError: any = err; }); - localforage.iterate((str: string, key: string, num: number) => { + localForage.iterate((str: string, key: string, num: number) => { var newStr: string = str; var newKey: string = key; var newNum: number = num; @@ -30,7 +30,7 @@ declare var promise: lf.IPromise; var newValue: string = value; }); - localforage.keys((err: any, keys: Array) => { + localForage.keys((err: any, keys: Array) => { var newError: any = err; var newArray: Array = keys; }); diff --git a/localForage/localForage.d.ts b/localForage/localForage.d.ts index 6cef3a9ea7ee22b54b15c43b5f6dff793ce9b361..42c738d1f29b1864d09568abd06aba9ae8110d22 100644 GIT binary patch delta 39 xcmV+?0NDTBBJ?7#Y7dj(3 Date: Sun, 17 May 2015 10:55:38 +0000 Subject: [PATCH 3/7] change --- localForage/localForage-tests.ts | 2 +- localForage/localForage.d.ts | Bin 4468 -> 2384 bytes 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/localForage/localForage-tests.ts b/localForage/localForage-tests.ts index 1e1ab4dd5..15638c1cb 100644 --- a/localForage/localForage-tests.ts +++ b/localForage/localForage-tests.ts @@ -1,4 +1,4 @@ -/// +/// declare var localForage: lf.ILocalForage; declare var callback: lf.ICallback; diff --git a/localForage/localForage.d.ts b/localForage/localForage.d.ts index 42c738d1f29b1864d09568abd06aba9ae8110d22..e6ccdfd59b4054fc3883858a60425e62b7233d27 100644 GIT binary patch literal 2384 zcmb7FZEn**5WUL$BdwxX1&V~JDj^EUDij3$!_T!nPL`~9quq6=K}bCa9DpBA?-r&IV;Q38jHYRPL>vW8C&dXQ79G&ePqOSO*LSQNFZIwt^n z=a>nm5lWR;0znk;js69CaY?iamLVi>wlbVto^B#sRCIXQ#=8?7!UrtX8V%qYbq!0b zq0p)XyC9vJWhpZ_1&y}SlFK=83swPxR1irpf?1pefKl(131oUgEfFcpmN6tRwO0B? zdp?L^t+=bpQ=zXr(z1sJ)>3 zhtwLu>NS!Gq>p4JQ7cFdN60CagOVhXf#htrDil1SPa<=?ia}Ooih2q?mCmv52>k~e zL38QZkW2*cwduNek3KHE-zFkpZZUYauT3O~X%z9rI2L^dswf1P2%ZH@_zY)Wq?_v> z0_EH;ZmxeG?AEJ^>GQkr*W6-wFG1#7gXMO<9UoeH5Ioh4hM&nCOto4GPW#}b(`YKu z4t&?2kS8RCkEC)TSCl4|1-znGOks|e#;cqhz!$Qoc893nLWCIojp=d-FDAV-tz0k~ zUCo1oI*?5BlaL3N+#sdwljtLJF5p()FSw*8_PVy4v1zL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7] fix linefield --- localForage/localForage.d.ts | 74 +++++++++++++++++++++++++++++++++++- 1 file changed, 73 insertions(+), 1 deletion(-) diff --git a/localForage/localForage.d.ts b/localForage/localForage.d.ts index e6ccdfd59..14bd6aedb 100644 --- a/localForage/localForage.d.ts +++ b/localForage/localForage.d.ts @@ -1 +1,73 @@ -// Type definitions for Mozilla's localForage
// Project: https://github.com/mozilla/localforage
// Definitions by: david pichsenmeister , Yuichi Nukiyama
// Definitions: https://github.com/borisyankov/DefinitelyTyped

declare module lf {
 interface ILocalForage {
 /**
 * Removes every key from the database, returning it to a blank slate.
 */
 clear(callback: IErrorCallback): void
 /**
 * Iterate over all value/key pairs in datastore.
 */
 iterate(iterateCallback: IIterateCallback): void
 /**
 * Get the name of a key based on its ID.
 */
 key(keyIndex: number, callback: IKeyCallback): void
 /**
 * Get the list of all keys in the datastore.
 */
 keys(callback: IKeysCallback): void;
 /**
 * Gets the number of keys in the offline store (i.e. its “length”).
 */
 length(callback: INumberCallback): void
 /**
 * Gets an item from the storage library and supplies the result to a callback.
 * If the key does not exist, getItem() will return null.
 */
 getItem(key: string, callback: ICallback): void
 getItem(key: string): IPromise
 /**
 * Saves data to an offline store.
 */
 setItem(key: string, value: T, callback: ICallback): void
 setItem(key: string, value: T): IPromise
 /**
 * Removes the value of a key from the offline store.
 */
 removeItem(key: string, callback: IErrorCallback): void
 removeItem(key: string): IPromise
 }

 interface ICallback {
 (err: any, value: T): void
 }

 interface IIterateCallback {
 (value: T, key: string, iterationNumber: number): void
 }

 interface IErrorCallback {
 (err: any): void
 }

 interface IKeyCallback {
 (err: any, keyName: string): void
 }

 interface IKeysCallback {
 (err: any, keys: Array): void
 }

 interface INumberCallback {
 (err: any, numberOfKeys: number): void
 }

 interface IPromise {
 then(callback: ICallback): void
 }
} \ No newline at end of file +// Type definitions for Mozilla's localForage +// Project: https://github.com/mozilla/localforage +// Definitions by: david pichsenmeister , Yuichi Nukiyama +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module lf { + interface ILocalForage { + /** + * Removes every key from the database, returning it to a blank slate. + */ + clear(callback: IErrorCallback): void + /** + * Iterate over all value/key pairs in datastore. + */ + iterate(iterateCallback: IIterateCallback): void + /** + * Get the name of a key based on its ID. + */ + key(keyIndex: number, callback: IKeyCallback): void + /** + * Get the list of all keys in the datastore. + */ + keys(callback: IKeysCallback): void; + /** + * Gets the number of keys in the offline store (i.e. its “length”). + */ + length(callback: INumberCallback): void + /** + * Gets an item from the storage library and supplies the result to a callback. + * If the key does not exist, getItem() will return null. + */ + getItem(key: string, callback: ICallback): void + getItem(key: string): IPromise + /** + * Saves data to an offline store. + */ + setItem(key: string, value: T, callback: ICallback): void + setItem(key: string, value: T): IPromise + /** + * Removes the value of a key from the offline store. + */ + removeItem(key: string, callback: IErrorCallback): void + removeItem(key: string): IPromise + } + + interface ICallback { + (err: any, value: T): void + } + + interface IIterateCallback { + (value: T, key: string, iterationNumber: number): void + } + + interface IErrorCallback { + (err: any): void + } + + interface IKeyCallback { + (err: any, keyName: string): void + } + + interface IKeysCallback { + (err: any, keys: Array): void + } + + interface INumberCallback { + (err: any, numberOfKeys: number): void + } + + interface IPromise { + then(callback: ICallback): void + } +} \ No newline at end of file From 6500933c82b4e8c48feb6f7069d3093eff31a948 Mon Sep 17 00:00:00 2001 From: YuichiNukiyama Date: Sun, 17 May 2015 11:02:48 +0000 Subject: [PATCH 5/7] fix2 --- localForage/localForage.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/localForage/localForage.d.ts b/localForage/localForage.d.ts index 14bd6aedb..e39ec73c6 100644 --- a/localForage/localForage.d.ts +++ b/localForage/localForage.d.ts @@ -1,6 +1,6 @@ // Type definitions for Mozilla's localForage // Project: https://github.com/mozilla/localforage -// Definitions by: david pichsenmeister , Yuichi Nukiyama +// Definitions by: david pichsenmeister ,Yuichi Nukiyama // Definitions: https://github.com/borisyankov/DefinitelyTyped declare module lf { From ef5547827ca46d0b62f718fc3fe5f80666c7bd6a Mon Sep 17 00:00:00 2001 From: YuichiNukiyama Date: Sun, 17 May 2015 11:05:24 +0000 Subject: [PATCH 6/7] fix3 --- localForage/localForage.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/localForage/localForage.d.ts b/localForage/localForage.d.ts index e39ec73c6..cb518a70e 100644 --- a/localForage/localForage.d.ts +++ b/localForage/localForage.d.ts @@ -1,6 +1,6 @@ // Type definitions for Mozilla's localForage // Project: https://github.com/mozilla/localforage -// Definitions by: david pichsenmeister ,Yuichi Nukiyama +// Definitions by: yuichi,david pichsenmeister // Definitions: https://github.com/borisyankov/DefinitelyTyped declare module lf { From c1e3d3654997f36dd063e4035582cd445081f25d Mon Sep 17 00:00:00 2001 From: YuichiNukiyama Date: Sun, 17 May 2015 11:08:11 +0000 Subject: [PATCH 7/7] FIX4 --- localForage/localForage.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/localForage/localForage.d.ts b/localForage/localForage.d.ts index cb518a70e..b5c40dd61 100644 --- a/localForage/localForage.d.ts +++ b/localForage/localForage.d.ts @@ -1,6 +1,6 @@ // Type definitions for Mozilla's localForage // Project: https://github.com/mozilla/localforage -// Definitions by: yuichi,david pichsenmeister +// Definitions by: yuichi david pichsenmeister // Definitions: https://github.com/borisyankov/DefinitelyTyped declare module lf {