Skip to content

Commit

Permalink
Reduce juddering in annotator.storage:
Browse files Browse the repository at this point in the history
- annotator.storage.debugStorage -> annotator.storage.debug
- annotator.storage.nullStorage -> annotator.storage.noop
  • Loading branch information
nickstenning committed Apr 15, 2015
1 parent e90cc06 commit 774a1de
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion dev.html
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ <h3>Header Level 3</h3>
var app = new annotator.App()
.include(annotator.ui.main, {element: elem})
.include(annotator.plugin.filter)
.include(annotator.storage.debugStorage)
.include(annotator.storage.debug)
.start()
</script>
</body>
Expand Down
10 changes: 5 additions & 5 deletions doc/api/app.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ annotator package
Run the named module hook and return a promise of the results of all the hook
functions. You won't usually need to run this yourself unless you are
extending the base functionality of App.

Optionally accepts an array of argument (`args`) to pass to each hook
function.

Expand All @@ -61,11 +61,11 @@ annotator package
.. function:: annotator.App.extend(object)

Create a new object which inherits from the App class.

For example, here we create a ``CustomApp`` which will include the
hypothetical ``mymodules.foo.bar`` module depending on the options object
passed into the constructor::

var CustomApp = annotator.App.extend({
constructor: function (options) {
App.apply(this);
Expand All @@ -74,9 +74,9 @@ annotator package
}
}
});

var app = new CustomApp({foo: 'bar'});

:returns: The subclass constructor.
:rtype: Function

Expand Down
8 changes: 4 additions & 4 deletions doc/api/storage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,25 @@
annotator.storage package
=========================

.. function:: annotator.storage.debugStorage()
.. function:: annotator.storage.debug()

A storage component that can be used to print details of the annotation
persistence processes to the console when developing other parts of
Annotator.

Use as a plugin module::
app.include(annotator.storage.debugStorage);
app.include(annotator.storage.debug);


.. function:: annotator.storage.nullStorage()
.. function:: annotator.storage.noop()

A no-op storage component. It swallows all calls and does the bare minimum
needed. Needless to say, it does not provide any real persistence.

Use as a plugin module::
app.include(annotator.storage.nullStorage);
app.include(annotator.storage.noop);


.. class:: annotator.storage.HTTPStorageImpl([options])
Expand Down
2 changes: 1 addition & 1 deletion src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function App() {
'notifier');

// And set up a default storage component.
this.include(storage.nullStorage);
this.include(storage.noop);
}


Expand Down
14 changes: 7 additions & 7 deletions src/storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,21 @@ var id = (function () {


/**
* function:: debugStorage()
* function:: debug()
*
* A storage component that can be used to print details of the annotation
* persistence processes to the console when developing other parts of
* Annotator.
*
* Use as a plugin module::
*
* app.include(annotator.storage.debugStorage);
* app.include(annotator.storage.debug);
*
*/
exports.debugStorage = function () {
exports.debug = function () {
function trace(action, annotation) {
var copyAnno = JSON.parse(JSON.stringify(annotation));
console.debug("DebugStore: " + action, copyAnno);
console.debug("annotator.storage.debug: " + action, copyAnno);
}

return {
Expand Down Expand Up @@ -66,17 +66,17 @@ exports.debugStorage = function () {


/**
* function:: nullStorage()
* function:: noop()
*
* A no-op storage component. It swallows all calls and does the bare minimum
* needed. Needless to say, it does not provide any real persistence.
*
* Use as a plugin module::
*
* app.include(annotator.storage.nullStorage);
* app.include(annotator.storage.noop);
*
*/
exports.nullStorage = function () {
exports.noop = function () {
return {
create: function (annotation) {
if (typeof annotation.id === 'undefined' ||
Expand Down

0 comments on commit 774a1de

Please sign in to comment.