Skip to content

Commit f0494c1

Browse files
committed
Use 'require'
1 parent d99b2b0 commit f0494c1

File tree

6 files changed

+7
-12
lines changed

6 files changed

+7
-12
lines changed

resources/codex/md/tools.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ To deploy an ~ec~ script you need to embed it in a web page. The basic mechanism
44
## Plugins ##
55
The standard ~ec~ language includes a wide range of general-purpose programming constructs needed by any language; variables, values, conditionals, strings, numbers and so on. Everything else is provided by plugins. Some of these, notably browser features, JSON and REST, are loaded automatically (though this behavior can be changed if necessary) and several more are available as optional plugins. Plugins add commands to the language and must be loaded before any script that makes use of those keywords will compile.
66

7-
The mechanism for requesting a plugin is very simple. Suppose you want to include a Google Map in your web page. You will need the ~code:gmap~ plugin, which is loaded like this:
7+
The mechanism for requesting a plugin is very simple. Suppose you want to include a Google Map in your web page. You will need the ~code:gmap~ plugin, which is loaded like this, where the ~ec~ files are all in a top-level `easycoder` folder:
88

9-
~pre:load plugin `gmap`~
9+
~pre:require js `easycoder/plugins/gmap.js`~
1010

1111
In this example the plugin is a standard ~ec~ one but you can also load third-party plugins from any URL if you deal with CORS issues.
1212

resources/doc/core.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,6 @@
100100
"description": "~m:index~ is a special command for array handling. In EasyCoder, all variables are arrays. Initially they only have one element but you can set an array to have as many elements as you like, using ~l:set!set the elements of {variable} to {value}~. Inside each array is the current index for the array, which you can set to any value within the number of elements in the array. The array is still used as if it were a simple variable and only the element pointed to by the index is affected by whatever you do with the array. Where multitasking is used - with ~l:fork~ or by handling an event - you must be careful to set the index before using the array if there~sq~s any chance it may have been modified by another part of the program.",
101101
"examples": "index List to 5%0aput Result into List"
102102
},
103-
"load": {
104-
"syntax": "load plugin {name}",
105-
"description": "~m:load~ currently has just one purpose; to load an _**EasyCoder**_ plugin module prior to running a script that requires its functionality. Until the plugin is loaded, using any of its script commands will cause compilation errors. This feature of _**EasyCoder**_ avoids the need for all modules to be loaded up-front, which improves the start-up time. It also permits pages to use functionality in a dynamic manner, which can be important in the planning of large single-page websites.\n\nIn any instance of _**EasyCoder**_ there are 2 kinds of plugin. The first kind are loaded when _**EasyCoder**_ itself starts. These are globally-defined plugins that will be needed by every page of the website, such as _browser_ and (usually) _json_.\n\nThe second kind of plugin is loaded by a script so that it can be used by another script. Any number of scripts can be run, by loading the text of the script then calling ~l:run~. Scripts loaded and run in this way may need to employ plugins that were not defined globally, so these must be loaded before the script is run.\n\nNote that a script cannot load plugins for its own use. This would be an impossibility since each plugin contains the compiler for the extra commands it makes available.\n\n_**EasyCoder**_ includes a growing number of plugins, which are covered by this documentation. In addition, third-party plugins may also be available. It is relatively straightforward for any competent JavaScript programmer to write a custom plugin to provide features for a specific website page. The plugin can be hosted anywhere and is loaded by giving its URL.",
106-
"examples": "load plugin `ckeditor`"
107-
},
108103
"negate": {
109104
"syntax": "negate {variable}",
110105
"description": "~mono:negate~ returns the value of the given variable subtracted from zero.",

resources/ecs/about.ecs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
end
3737

3838
set ready
39-
load plugin `codemirror`
39+
require js `dist/plugins/codemirror.js`
4040
stop
4141

4242
Start:
@@ -54,7 +54,7 @@ Start:
5454
attach CodexButton to `about-codex`
5555
on click CodexButton
5656
begin
57-
load plugin `codemirror`
57+
require js `dist/plugins/codemirror.js`
5858
rest get Codex from `/resources/ecs/codex`
5959
send `hide` to parent
6060
run Codex

resources/scripts/codex.ecs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
! set Mobile
9494
set ShowRun
9595

96-
load plugin `svg`
96+
require js `dist/plugins/svg.js`
9797

9898
codemirror init basic profile `/easycoder/plugins/codemirror-ecs.js`
9999
require css `https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.46.0/addon/dialog/dialog.css`

resources/scripts/gmap_loader.ecs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
load plugin `gmap`
1+
require js `dist/plugins/gmap.js`

scripted.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
script ScriptEditor
1515

1616
variable Script
17-
load plugin `codemirror`
17+
require js `dist/plugins/codemirror.js`
1818
rest get Script from `/resources/ecs/scripted.ecs`
1919
run Script
2020
</pre>

0 commit comments

Comments
 (0)