wq.app 0.8.0
wq.app 0.8.0 brings a long-overdue overhaul of wq/store.js to clean up technical debt and bring it up-to-date with modern browser capabilities. This release also introduces a more extensible click-based wq
CLI.
API Changes
- wq/store.js overhaul (#20, #48)
- Use localForage instead of
localStorage
to handle offline data storage (#20). This brings the option of usingIndexedDB
in browsers that support it. - Switch to an almost entirely asynchronous API (#17), using promises (#5) which are provided with
localForage
. - Split
getList()
and related functionality into a separate module, wq/model.js (#20). Also split outbox features into separate wq/outbox.js module. - rename
unsavedItems()
andobitem.saved
tounsyncedItems()
andobitem.synced
(#27)
- Use localForage instead of
- wq/app.js + wq/store.js
- enable saving of Blobs (i.e. user-contributed photos) in the outbox until network is available (#22)
- make
backgroundSync
the default, unifypostsave
andpostsubmit
into a single method, and simplify method signatures - use current auth data when syncing outbox (#49)
- wq/pages.js
- rename to
wq/router.js
(#26) - parts of the internal implementation (related to injecting rendered HTML into the DOM) have been moved to wq/template.js.
- rename to
- wq/map.js:
- Require bounds instead of center+zoom for default extent (#44)
- wq/photos.js:
- Use
URL.createObjectURL
rather thanFileReader
for image previews. (4b05b5a070206ba8c72e3d5ee51a6e28d0b50adf)
- Use
- wq build:
- General API Cleanup
- simplify
init()
usage in wq/app.js, wq/store.js, wq/pages.js, wq/template.js (#28) - use namespace for data- properties (#42)
- Code style: enforce curly braces over one-line conditionals
- Add
and
as template variable aliases forand
, respectively (c500ceec8257917f910ca07e81384914dac40d78)
- simplify
Upgrade Notes
If you are installing wq.app for the first time, you do not need to worry about the notes in this section.
- The core
wq
CLI was previously part of wq.app, but is now in a separate package, wq.core. If you are upgrading an existing wq.app installation, we recommend uninstalling and re-installing wq.app. If you don’t do this, the upgrade will likely install wq.core before upgrading wq.app, which will cause the newwq
executable to be wiped out while uninstalling the old wq.app. If this happens, you may see an error like the following:bash: /usr/local/bin/wq: No such file or directory
. The fix is to uninstall both wq.core and wq.app and then install wq.app again. - If you are using wq/store.js directly, note that the API has changed significantly since previous versions. In particular, be sure to read up on the new wq/model.js and wq/outbox.js modules. Also, if you are using wq/store.js together with wq/app.js, you may want to take advantage of the new built-in
app.models
object that will contain model API instances for all models listed in the wq configuration. - If you are using wq/app.js, wq/pages.js, wq/store.js, or wq/template.js, note that the configuration structure has been changed so that each module takes a single
init()
configuration argument. See the respective module documentation pages for details. - Make sure you have a file called
wq.yml
or specify a filename when running thewq build
process. JSON is YAML, so if you have an existingapp.build.json
you should be able to rename it towq.yml
and use it as-is. - Update your templates to reference all wq-specific attributes as e.g.
data-wq-json
rather thandata-json
.