Commit graph

17 commits

Author SHA1 Message Date
Gina Häußge
eaadf8743b Allow multiple instances of the JS client
We now have a global OctoPrintClient, which is the class from which
all clients are derived, and a global OctoPrint, which is a single
instance already setup and ready to use in case we only need one.

It would be cleaner to have clients create that singular instance
themselves, but we need to maintain backward compatibility for now
with how we established the client to work with the 1.3.0 release.

New clients can be create with

    client = new OctoPrintClient({ /* options */ });

Alternatively the options can be left out and set at a later point:

    client = new OctoPrintClient();
    /* ... */
    client.options = { /* options */ };

Individual client components register themselves with OctoPrintClient
via OctoPrintClient.registerComponent(name, component) from the
component JS files. Just like before their instances are then
available in the individual client instances under "<client>.<name>",
 e.g. "OctoPrint.files".

Plugin components register themselves with OctoPrintClient via
OctoPrintClient.registerPluginComponent(name, component) from the
component JS files. Just like before their instances are then
available in the individual client instances under "<client>.plugins
.<name>", e.g. "OctoPrint.plugins.softwareupdate".

This should make it possible to create dashboard pages utilizing the
JS client that monitor the status of multiple OctoPrint instances,
without workarounds such as having to swap out the options globally
before each request.

See #1681 for the corresponding discussion.
2017-01-26 14:59:56 +01:00
Gina Häußge
558a8957f9 Fix docs for OctoPrint.upload method 2016-12-07 10:59:16 +01:00
Gina Häußge
65377b396f Added note that jquery and lodash are dependencies of the js client lib 2016-11-28 11:29:17 +01:00
Gina Häußge
0d13c3b439 Add OctoPrint.options.locale and if set send X-Locale header on requests
See #1593
2016-11-18 07:56:49 +01:00
Gina Häußge
20d15b2abb Documented usage of js client lib 2016-10-18 11:26:17 +02:00
Gina Häußge
82ae52e619 More docs & client fixes 2016-09-28 12:53:43 +02:00
Gina Häußge
4e69b260a1 Docs for user API
Also some fixes on said API and some fixes in the docs
2016-09-28 11:18:43 +02:00
Gina Häußge
82ae3f6f6e Re-added two utility methods removed in d9e3553c7c
They are still useful for other clients than the core application. Renamed them to fit the
general naming on the API however:

  * pathForElement is now called pathForEntry
  * elementByPath is now called entryForPath
2016-09-28 10:21:27 +02:00
Gina Häußge
0b551f6b7e Some more documentation 2016-09-22 22:21:52 +02:00
Gina Häußge
8e8853c9c3 Lots of documentation updates + some related code fixes 2016-09-22 16:27:06 +02:00
Gina Häußge
a13e12bb5e More work on JS Client documentation 2016-08-26 17:47:38 +02:00
Gina Häußge
52d272bd24 More work on the docs 2016-07-01 17:52:40 +02:00
Gina Häußge
cec2f7d917 WIP: More work on the documentation of the js client lib 2016-06-30 12:06:08 +02:00
Gina Häußge
b8405becb3 Fixed a typo 2016-06-29 09:41:53 +02:00
Gina Häußge
ca8bbe2de4 JS Client docs for OctoPrint.connection 2016-06-29 09:28:55 +02:00
Gina Häußge
5611f87339 Docs for JS client lib's base module 2016-06-28 19:22:31 +02:00
Gina Häußge
6016b04d03 WIP: Started on JS Client docs 2016-06-15 09:47:32 +02:00