GoJS tutorial to build flowchart control from TypeScript source code

GoJS is a powerful, fast and lightweight flowchart control that can help you create flowcharts in JavaScript and HTML5 Canvas programs, and greatly simplify your JavaScript / Canvas programs.

Click to download the latest version of GoJS

All customers can use go.js and go-debug.js files to run their applications. However, if you have purchased a license for the GoJS TypeScript source code, you can build your application from the TypeScript source. Popular module packers (such as Webpack) can remove many modules from the source (if you don't use them) to reduce the size of the deliverable file.

Since the go.js and go-debug.js files are built during the customization process with the purpose of reducing the size, even if WebWeb or other bundlers are used with GoJS sources, even if it deletes unused modules, it may The file size is larger than just using go.js. However, TypeScript authors may like the feedback and debugging features built from source code.

MinimalSource and MaximalSource projects

The GoJS suite has two subdirectories under /projects directory/minimalSource and /maximalSource.

This minimalSource project shows how to build GoJS while removing all possible optional modules. The maximalSource project shows how to build GoJS while matching the function of releasing go.js and de-debug.js file.

These two projects require webpack and npm to run.

There is also minimalSourceBrowserify, which shows how to build from source using Browserify instead of Webpack.

Classes/modules that can be deleted when building from source

Several classes (such as CommandHandler and tools) may be essential for adding to your project, while other classes (for example, all classes except one Layout and one type) Model can usually be deleted. The following is a list of modules that webpack can remove from the build, provided that these modules are not referenced in your code:
CommandHandler, which is required for keyboard functionality.
SVGSurface needs to call Diagram.makeSvg
tree model
GraphLinksModel without loading this module. The default Diagram.model type is Model.
Overview
palette
layout:
grid layout
tree layout
LayeredDigraphLayout
ring layout
ForceDirectedLayout.
Mouse down tool:
Action tool
Relink tool
Link reshaping tool
Resize tool
Rotation tool
Mouse movement tool:
Link tool
Drag tool
DragSelecting tool
Translation tool
Mouse up tool:
ContextMenu tool
Text editing tool
ClickCreating
tool
There are several built-in tools "Panel types, each type is PanelLayout. Some of them are necessary to build the source:
PanelLayoutPosition
PanelLayoutVertical
PanelLayoutLink
PanelLayoutAuto
PanelLayoutGrid
However, it can be constructed without the following panel types:
PanelLayoutHorizontal
PanelLayoutSpot
PanelLayoutTable
PanelLayoutViewbox
PanelLayoutTableRow
PanelLayoutTableColumn
PanelLayoutGraduated The
source index file demonstrates that Panel.addPanelLayout includes the necessary calls for each panel type.
Use optional classes

Many classes only need to be included in the source code build. For certain functions, such as tools, CommandHandler and SVGSurface, you need to make sure to initialize them explicitly. You can find this example in the maximal-index.ts code of the maximalSource project. The complete go.js library does not need to do this, because the go object already has a reference to each object.

A typical GoJS project will not delete all or even most of these modules, and may use most of them. Since Northwood's internal build process has been optimized to use the Google Closure compiler in advanced mode, it may take a lot of effort to generate a package from the source code of go.js that is smaller than the package contained in the project distribution directory.

Important license information about GoJS source code

The GoJS source code is subject to our license terms contained in SoftwareLicenseAgreement.pdf.

Do not use, release (deploy) or distribute unminified source code. To build GoJS for your own application, you have to use popular obfuscation/minification tools such as Google Closure Compiler.

If you think you can benefit from other graphics optimizations, then you will encounter unique or large number of nodes, please contact customer service.

If you want to buy a genuine GoJS license, or for more product information, please click [Consult online customer service]

Guess you like

Origin blog.51cto.com/14874181/2551921