-
-
Notifications
You must be signed in to change notification settings - Fork 305
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
15,182 additions
and
36 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,6 +1,6 @@ | ||
{ | ||
"name": "Twine", | ||
"version": "2.2.0-beta1", | ||
"version": "2.2.0", | ||
"author": "Chris Klimas <[email protected]>", | ||
"description": "a GUI for creating nonlinear stories", | ||
"license": "GPL-3.0", | ||
|
@@ -30,20 +30,15 @@ | |
"watch": "webpack -d --progress --watch" | ||
}, | ||
"dependencies": { | ||
"babel-loader": "^6.2.10", | ||
"blob-polyfill": "^1.0.20150320", | ||
"browser-saveas": "^1.0.0", | ||
"codemirror": "^5.5.0", | ||
"core-js": "^2.4.0", | ||
"ejs-html-loader": "^2.0.2", | ||
"extract-text-webpack-plugin": "^2.0.0-rc.3", | ||
"fastclick": "^1.0.6", | ||
"font-awesome": "^4.3.0", | ||
"html-webpack-plugin": "^2.28.0", | ||
"jed": "^1.1.0", | ||
"jsonp": "^0.2.1", | ||
"jszip": "^2.5.0", | ||
"karma-webpack": "^2.0.4", | ||
"lodash.escape": "^4.0.1", | ||
"lodash.uniq": "^4.5.0", | ||
"lodash.values": "^4.3.0", | ||
|
@@ -76,7 +71,7 @@ | |
"ejs-loader": "^0.3.0", | ||
"eslint": "^3.10.2", | ||
"estraverse": "^4.2.0", | ||
"extract-text-webpack-plugin": "^2.1.2", | ||
"extract-text-webpack-plugin": "^3.0.2", | ||
"file-loader": "^0.11.2", | ||
"fs-extra": "^1.0.0", | ||
"glob": "^7.1.1", | ||
|
@@ -92,7 +87,7 @@ | |
"less-plugin-autoprefix": "^1.5.1", | ||
"less-plugin-clean-css": "^1.5.1", | ||
"mocha": "^3.2.0", | ||
"mocha-webpack": "^0.7.0", | ||
"mocha-webpack": "^1.0.1", | ||
"mock-local-storage": "^1.0.4", | ||
"null-loader": "^0.1.1", | ||
"nw-builder": "^3.2.0", | ||
|
@@ -103,8 +98,8 @@ | |
"sinon": "^3.2.1", | ||
"style-loader": "^0.18.2", | ||
"url-loader": "^0.5.9", | ||
"webpack": "^3.5.5", | ||
"webpack-dev-server": "^2.7.1", | ||
"webpack": "^3.10.0", | ||
"webpack-dev-server": "^2.9.5", | ||
"webpack-node-externals": "^1.6.0", | ||
"yargs": "^6.6.0" | ||
} | ||
|
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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
Manages a queue for saving story files. We can't save story files immediately as | ||
the user edits them, because the changes come so rapidly. Instead, we queue | ||
saves up and periodically flush the queue. | ||
You *must* call flush() on this module before the application closes to prevent | ||
data loss. | ||
*/ | ||
|
||
const StoryFile = require('./story-file'); | ||
|
||
let idQueue = []; | ||
let flushTimeout; | ||
|
||
const SaveQueue = module.exports = { | ||
/* How long to wait to flush the queue, in milliseconds. */ | ||
|
||
delay: 10000, | ||
|
||
/* | ||
Attaches to a Vuex store, for retrieval of stories. Must be called before | ||
any flush() call. | ||
*/ | ||
|
||
attachStore(store) { | ||
SaveQueue.store = store; | ||
}, | ||
|
||
/* | ||
Queues an story to be saved. Repeated requests to save the same story don't | ||
change the queue, but they do reset the delay to save. | ||
*/ | ||
|
||
queue(id) { | ||
if (flushTimeout) { | ||
window.clearTimeout(flushTimeout); | ||
} | ||
|
||
flushTimeout = window.setTimeout(SaveQueue.flush, SaveQueue.delay); | ||
|
||
if (idQueue.indexOf(id) === -1) { | ||
idQueue.push(id); | ||
} | ||
}, | ||
|
||
/* | ||
Saves all pending stories. | ||
*/ | ||
|
||
flush() { | ||
if (!SaveQueue.store) { | ||
throw new Error('No store has been set for this save queue'); | ||
} | ||
|
||
while (idQueue.length > 0) { | ||
const id = idQueue.pop(); | ||
const story = SaveQueue.store.state.story.stories.find( | ||
s => s.id === id | ||
); | ||
|
||
StoryFile.save(story, SaveQueue.store.state.appInfo); | ||
} | ||
} | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
const { expect } = require('chai'); | ||
const { stub } = require('sinon'); | ||
const storyFile = require('./story-file'); | ||
const saveQueue = require('./save-queue'); | ||
|
||
describe('SaveQueue', () => { | ||
let fakeStore = { | ||
state: { | ||
story: { | ||
stories: [ | ||
{ | ||
name: 'test', | ||
id: 'not-a-real-id' | ||
} | ||
] | ||
} | ||
} | ||
}; | ||
|
||
beforeEach(() => { | ||
stub(storyFile, 'save'); | ||
}); | ||
|
||
afterEach(() => { | ||
storyFile.save.restore(); | ||
}); | ||
|
||
it('triggers a save action after its delay elapses', done => { | ||
storyFile.save.callsFake(story => { | ||
expect(story.name).to.equal('test'); | ||
expect(story.id).to.equal('not-a-real-id'); | ||
done(); | ||
}); | ||
saveQueue.attachStore(fakeStore); | ||
saveQueue.delay = 100; | ||
saveQueue.queue('not-a-real-id'); | ||
}); | ||
|
||
it('immediately saves on flush()', () => { | ||
saveQueue.attachStore(fakeStore); | ||
saveQueue.delay = 10000; | ||
saveQueue.queue('not-a-real-id'); | ||
saveQueue.flush(); | ||
expect(storyFile.save.calledOnce); | ||
expect(storyFile.save.firstCall.calledWith('not-a-real-id')); | ||
}); | ||
}); |
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
File renamed without changes
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
story-formats/sugarcube-2.18.0/format.js → story-formats/sugarcube-2.21.0/format.js
Large diffs are not rendered by default.
Oops, something went wrong.
File renamed without changes