Skip to content

Commit

Permalink
fix: also check for window
Browse files Browse the repository at this point in the history
  • Loading branch information
ghostdevv authored and joshnuss committed Aug 21, 2022
1 parent 3ddd27e commit be89063
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ interface Options<T> {
}

export function writable<T>(key: string, initialValue: T, options?: Options<T>): Writable<T> {
const browser = typeof(localStorage) != 'undefined'
const browser = typeof(localStorage) != 'undefined' && typeof(window) != 'undefined'
const serializer = options?.serializer || JSON

function updateStorage(key: string, value: T) {
Expand Down

0 comments on commit be89063

Please sign in to comment.