Dump

Namespace

The JXG.Dump namespace provides classes and methods to save a board to javascript.

Methods

Own

(private, static) _minimizeSubObject(instance, def, pre)

Recursively determine the difference between objects instance and def.

Parameters

Name Type Description
instance Object

Attribute object of the element. Usually a copy is supplied

def Object

Default attributes, the instance is compared to

pre String

Helper string for debug output

Returns

Boolean true if all elements can be deleted

Details

Source
utils/dump.js, line 124

(static) addMarkers(board, markers, values)

Adds markers to every element of the board

Parameters

Name Type Description
board JXG.Board
markers Array | String
values Array

Details

Source
utils/dump.js, line 53

(static) arrayToParamStr(a, converter) → {String}

Converts an array of different values into a parameter string that can be used by the code generators.

Parameters

Name Type Description
a Array
converter function

A function that is used to transform the elements of a. Usually JXG.toJSON or JXG.Dump.toJCAN are used.

Returns

Type
String

Details

Source
utils/dump.js, line 373

(static) deleteMarkers(board, markers)

Removes markers from every element on the board.

Parameters

Name Type Description
board JXG.Board
markers Array | String

Details

Source
utils/dump.js, line 83

(static) dump(board, jsonopt) → {Array}

Generate a store-able structure with all elements. This is used by JXG.Dump#toJessie and JXG.Dump#toJavaScript to generate the script.

Parameters

Name Type Attributes Default Description
board JXG.Board
json Boolean <optional>
false

If a JavaScript object for JSON should be returned then do not enclose strings in quotes.

Returns

An array with all metadata necessary to save the construction.

Type
Array

Details

See
  • JXG.Dump#toJSON
  • JXG.Dump#toJavaScript
  • JXG.Dump#toJessie
Source
utils/dump.js, line 305

(static) minimizeObject(instance, s) → {Object}

Eliminate default values given by JXG.Options from the attributes object.

Parameters

Name Type Description
instance Object

Attribute object of the element

s Object

Arbitrary number of objects instance will be compared to. Usually these are sub-objects of the JXG.Board#options structure.

Returns

Minimal attributes object

Type
Object

Details

Source
utils/dump.js, line 189

(static) prepareAttributes(board, obj) → {Object}

Prepare the attributes object for an element to be dumped as JavaScript or JessieCode code.

Parameters

Name Type Description
board JXG.Board
obj JXG.GeometryElement

Geometry element which attributes object is generated

Returns

An attributes object.

Type
Object

Details

Source
utils/dump.js, line 237

(static) str(s) → {String}

Stringifies a string, i.e. puts some quotation marks around s if it is of type string.

Parameters

Name Type Description
s *

Returns

" + s + "

Type
String

Details

Source
utils/dump.js, line 108

(static) toJCAN(obj) → {String}

Converts a JavaScript object into a JCAN (JessieCode Attribute Notation) string.

Parameters

Name Type Description
obj Object

A JavaScript object, functions will be ignored.

Returns

The given object stored in a JCAN string.

Type
String

Details

Source
utils/dump.js, line 389

(static) toJSON(board, asObjopt) → {String}

Export the construction as JSON string. Wrapper of JXG.Dump#dump, i.e. a store-able structure with all elements.

Parameters

Name Type Attributes Default Description
board JXG.Board
asObj Boolean <optional>
false

If false, return a JSON string, else return a JavaScript object.

Returns

The construction as JSON string (or object)

Type
String

Details

See
  • JXG.Dump#dump
  • JXG.Dump#toJessie
  • JXG.Dump#toJavaScript
Source
utils/dump.js, line 513

(static) toJavaScript(board) → {String}

Exports the construction in board to JavaScript.

Parameters

Name Type Description
board JXG.Board

Returns

The construction as JavaScript code

Type
String

Details

See
  • JXG.Dump#dump
  • JXG.Dump#toJSON
  • JXG.Dump#toJessie
Source
utils/dump.js, line 560

(static) toJessie(board, noAttributesopt) → {String}

Exports the construction in board to JessieCode.

Parameters

Name Type Attributes Default Description
board JXG.Board
noAttributes Boolean <optional>
false

If true, output contains no attributes beside 'id' and 'name'

Returns

The construction as JessieCode code

Type
String

Details

See
  • JXG.Dump#dump
  • JXG.Dump#toJSON
  • JXG.Dump#toJavaScript
Source
utils/dump.js, line 433

Inherited

none

Details

Dump

Source
utils/dump.js, line 46