Front-Git
This is a framework for JavaScript (TypeScript) that can manage data like Git.
Since it was made for studying, there is no practicality so far.
Example
; const initState = name: "John" age: 31 ; const git = ; gitremote; git; git; git; git;git; git;
Usage
createGit
imoprt createGit from "front-git"; const initState = hello: "world!"; const git = ;
add
// ... const git = ; // OK👌git;git;git;git; // NG👎git;git;git;git;
commit
// ... const git = ; // OK👌git;git; // NG👎git;git;
subscribe
// ... const git = ; git; git; git; // Add was executed ! git; // Commit was executed !
getIndex
// ... const git = ; let index = git; // null git; state = git; // { name: "hoge" } git; state = git; // null
getState
// ... const git = ; let state = git; // { name: "John", age: 31 } git; state = git; // { name: "John", age: 31 } git; state = git; // { name: "hoge", age: 31 }
getCurrentState
// ... const git = ; let state = git; // { name: "John", age: 31 } git; state = git; // { name: "hoge", age: 31 } git; state = git; // { name: "hoge", age: 31 }
getLogs
// ... const git = ; let logs = git; // [] git; logs = git;/*[ { id: "xxxxxxxxxxxx", comment: "First Commit", log: { ex: { name: "John" }, diff: { name: "hoge" } }, created_at: new Date() }]*/
clearIndex
// ... const git = ; let index = git; // null git; state = git; // { name: "hoge" } git; state = git; // null
revertLog
// ... // initconst git = ;let state = git; // { name: "John", age: 31 }let logs = git; // [] // commitgit;state = git; // { name: "hoge", age: 31 }logs = git; // [ {...} ] // commitgit;state = git; // { name: "hoge", age: 100 }logs = git; // [ {...}, {...} ] // revertLoggit;state = git; // { name: "hoge", age: 31 }logs = git; // [ {...} ] // revertLoggit;state = git; // { name: "John", age: 31 }logs = git; // []
remote.set
// ... const git = ; // OK👌gitremote; // NG👎git;git;
push
// ... const git = ; // OK👌gitremote;git; // NG👎git;git;
pull
// ... const git = ; // OK👌gitremote;git; // NG👎git;git;