Created
August 3, 2017 13:45
-
-
Save ayberkanilatsiz/3da1d17adaa33ebe81bb9d1cc014e0c9 to your computer and use it in GitHub Desktop.
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
createNewKey(name,backgroundColor){ | |
return new Promise((resolve,reject)=>{ | |
this.getItems().then((data)=>{ | |
let tempKey = new Date().getTime(); | |
data[tempKey] = { | |
name, //Count Name | |
count:0, | |
backgroundColor, // Count Background Color | |
counts:[] // counts | |
}; | |
AsyncStorage.setItem('count', JSON.stringify(data), (err,result) => { | |
if(err){ | |
reject({err:'something went wrong!'}); | |
}else{ | |
resolve(true); | |
} | |
}); | |
}); | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment