From 4bc1e2f5826d931feae277e6c1573c70ea65aa99 Mon Sep 17 00:00:00 2001 From: walterhiggins Date: Sat, 11 Apr 2015 10:43:33 +0100 Subject: [PATCH] Deprecating plugin() function --- docs/API-Reference.md | 22 +++++++++++++--------- src/main/js/lib/scriptcraft.js | 17 ++++++++++++----- 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/docs/API-Reference.md b/docs/API-Reference.md index 4af5614..724379e 100644 --- a/docs/API-Reference.md +++ b/docs/API-Reference.md @@ -705,11 +705,12 @@ scload() will return the result of the last statement evaluated in the file. The scsave() function saves an in-memory javascript object to a specified file. Under the hood, scsave() uses JSON (specifically -json2.js) to save the object. Again, there will usually be no need to -call this function directly as all javascript plugins' state are saved -automatically if they are declared using the `plugin()` function. Any -in-memory object saved using the `scsave()` function can later be -restored using the `scload()` function. +json2.js) to save the object. There will usually be no need to call +this function directly - If you want to have a javascript object +automatically loaded at startup and saved on shutdown then use the +`persist()` module. The `persist()` module uses scsave and scload +under the hood. Any in-memory object saved using the `scsave()` +function can later be restored using the `scload()` function. #### Parameters @@ -734,6 +735,12 @@ scsave(myObject, 'johndoe.json'); ### plugin() function +#### Update April 2015 +The `plugin()` function is deprecated. Please refer to [Anatomy of a +ScriptCraft Plugin][anatomy] for an up-to-date step-by-step guide to +creating a plugin which uses persistence (loading and saving data). + +#### Deprecated The `plugin()` function should be used to declare a javascript module whose state you want to have managed by ScriptCraft - that is - a Module whose state will be loaded at start up and saved at shut down. @@ -3311,10 +3318,7 @@ ScriptCraft uses Java's [String.format()][strfmt] so any string substitution ide ## Drone Plugin -The Drone is a convenience class for building. It can be used for... - - 1. Building - 2. Copying and Pasting +The Drone is a convenience class for building. It uses a fluent interface which means all of the Drone's methods return `this` and can be chained together like so... diff --git a/src/main/js/lib/scriptcraft.js b/src/main/js/lib/scriptcraft.js index 5519ac6..0f7428d 100644 --- a/src/main/js/lib/scriptcraft.js +++ b/src/main/js/lib/scriptcraft.js @@ -230,11 +230,12 @@ scload() will return the result of the last statement evaluated in the file. The scsave() function saves an in-memory javascript object to a specified file. Under the hood, scsave() uses JSON (specifically -json2.js) to save the object. Again, there will usually be no need to -call this function directly as all javascript plugins' state are saved -automatically if they are declared using the `plugin()` function. Any -in-memory object saved using the `scsave()` function can later be -restored using the `scload()` function. +json2.js) to save the object. There will usually be no need to call +this function directly - If you want to have a javascript object +automatically loaded at startup and saved on shutdown then use the +`persist()` module. The `persist()` module uses scsave and scload +under the hood. Any in-memory object saved using the `scsave()` +function can later be restored using the `scload()` function. #### Parameters @@ -259,6 +260,12 @@ scsave(myObject, 'johndoe.json'); ### plugin() function +#### Update April 2015 +The `plugin()` function is deprecated. Please refer to [Anatomy of a +ScriptCraft Plugin][anatomy] for an up-to-date step-by-step guide to +creating a plugin which uses persistence (loading and saving data). + +#### Deprecated The `plugin()` function should be used to declare a javascript module whose state you want to have managed by ScriptCraft - that is - a Module whose state will be loaded at start up and saved at shut down.