edge

The edge object groups the functions that connect the playground to RTEdge.net: deploy and delete with edge.save.limit(), measure the code with edge.size(), browse past deployments with edge.versions(), and open the deployed pages with edge.open().

It is a global of the playground window. Each function is the script form of a menu command, so an agent working through io.eval.js can do what you do with Ctrl+S / ⌘+S and the Edge and Code menus. The routes they use come from Code.D. Deployed pages on RTEdge.net do not have edge.

Instance methods

edge.save.limit()

Deploys the playground to every route in Code.D, or deletes the deployments at those routes. Resolves to a result object.

edge.size()

Measures the source, the o: exports and the worker, locally, for a deployed route or for a saved version, and resolves to a JSON report.

edge.size.text()

The same measurement as an aligned text table.

edge.size.local()

A snapshot of what the editor source would deploy, without any network request.

edge.size.open()

Opens the Code: Size dialog.

edge.versions()

Lists the saved versions of a route, newest first.

edge.versions.load()

Writes one saved version into the agent folder as a file. Needs Agent Folder Share.

edge.open()

Opens the deployed page of the first route in Code.D in a new tab.

js
edge.open()
edge.open(options)

The optional options object has one property:

all Optional

A boolean value: true opens every route in Code.D, each in its own tab. The default is false.

The tabs open with noopener and noreferrer, and the call returns undefined. When Code.D is empty it shows the toast No routes to open. and returns 0. It is the script form of Edge: Open… (Ctrl+E / ⌘+E) and Edge: Open All Routes… (Ctrl+Shift+E / ⌘+Shift+E).

Note: A call from io.eval.js has no user activation, so the browser may block the new tabs.

edge.open.map() Experimental

Opens the RTEdge.net network map, https://rtedge.net, in a window named _rtedge_net. It is the script form of Edge ▸ Network.

Menu commands and their calls

Every call below does what the command does. Commands and Keyboard shortcuts list the rest.

CommandKeysCall
Edge: DeployCtrl+S / ⌘+Sedge.save.limit()
Edge: Deploy with Message…Ctrl+Alt+S / ⌘+⌥+SAsks for a "Commit message", then edge.save.limit({ message })
Edge: Delete…Shift+Deleteedge.save.limit({ path: '/del' })
Edge: Open…Ctrl+E / ⌘+Eedge.open()
Edge: Open All Routes…Ctrl+Shift+E / ⌘+Shift+Eedge.open({ all: true })
Code: Size…Alt+Shift+Sedge.size.open({ mode: 'local' })
Code: Size (Deployed)…Command paletteedge.size.open({ mode: 'deployed' })
Edge ▸ NetworkMenuedge.open.map()

Examples

Measuring, then deploying

Write each command to io.eval.js and read io.eval.json before the next one. A local measurement needs no route and no network.

js
(await edge.size({ mode: 'local' })).total
js
const r = await edge.save.limit({ message: 'First version' });
r.ok ? Object.keys(r.response.D) : r

Browsing the history

js
(await edge.versions()).slice(0, 3)
js
await edge.versions.load(1)

Then read or diff the written 🕐.1.<sha>.html file with your own tools. edge.versions() has the details.

Specifications

Not part of any specification. edge is an RTCode.io playground global.

Availability

FeaturePlaygroundRTEdge.netNotes
edge.save.limit()YesNoNeeds a signed-in account. May open dialogs and wait for you.
edge.size()YesNoA local measurement needs no route. Deployed and saved-version measurements need the route; saved versions also need sign-in.
edge.versions()YesNoNeeds a signed-in account. load() also needs Agent Folder Share.
edge.open()YesNoWithout a user gesture the browser may block the tabs.
edge.open.map()YesNoExperimental.

See also