An array of GoJS Diagrams whose model(s) will be saved to / loaded from Local Storage. Can also be a single Diagram.
String representation of the default model data for new diagrams. If this is null, default new diagrams will be empty. Usually a value given by calling .toJson() on a GoJS Diagram's Model.
The directory path relative to the page in which this instance of GoLocalStorage exists, in which the storage service brand icons can be found. The default value is "../goCloudStorageIcons/".
Get the name of the class; i.e. "GoDropbox"
Get the clientId for the app using the cloud storage service. This is usually given by the cloud storage provider's dev console or similar. Set with a parameter during construction.
Get or set the currently open DiagramFile. By default, currentDiagramFile is set when a file is loaded from storage, saved to storage (if saved to a different path from the currentDiagramFile.path), or deleted from storage (if the deleted file is the currently open one). The default value is a DiagramFile with null id, name, and path values.
Get / set the defaultModel data for the app used by an instance of GoCloudStorage. defaultModel is used when creating new diagrams. See create.
Get / set iconsRelativeDirectory, the directory path relative to the page in which this instance of GoCloudStorage exists, in which the storage service brand icons can be found. The default value is "../goCloudStorageIcons/".
Get or set isAutoSaving property. If true, the managedDiagrams will be saved to storage after every
Transaction (only if currentDiagramFile holds a non-null path value).
Additionally, if isAutoSaving is true, users will be prompted to save newly created diagrams when created with create.
The default value for isAutoSaving is true
.
Get the browser window's Local Storage property.
Get / set the GoJS Diagrams associated with this instance of GoCloudStorage. Set with a parameter during construction.
Get the name of the cloud storage service being used; i.e. "Dropbox"
Get the UI element associated with this instance of GoCloudStorage. This is a custom filepicker window for GoDropBox and GoLocalStorage. It is a save prompt for GoOneDrive and GoGoogleDrive (both these classes use third party UI for storage navigation, provided by Microsoft and Google, respectively). The UI element is created during construction.
Check if Local Storage is supported by the current browser.
This parameter can be ignored. It exists only to maintain GoCloudStorage system structure
Returns a Promise that resolves with a boolean (true if local storage is supported, false if not)
Check whether a file exists in LocalStorage at a given path.
A valid key corresponding to a saved diagram file in Local Storage
Returns a Promise that resolves with a boolean stating whether a file exists in LocalStorage at a given path
Set each of managedDiagrams' .model to defaultModel (if defaultModel is null, each model will be set to a new GraphLinksModel by default). If isAutoSaving is true and no path parameter is supplied, users will be immediately prompted to save their new diagrams to cloud storage.
If a valid filepath is supplied, save each of managedDiagrams' model data to this path. No UI of any sort appears. What is meant by "valid filepath" varies from subclass to subclass. Rules for valid filepaths by subclass:
example.diagram
/{path-to-file}/{filename}
; i.e. /Public/example.diagram
/drive/root:/{path-to-file}/{filename}
; i.e. /drive/root:/Documents/example.diagram
Returns a Promise that resolves with a DiagramFile representing the newly created file.
Get information about a diagram file saved to local storage. This data includes:
Note: Id, name, and path are all provided (despite being the same). They are requisite for creating valid DiagramFiles.
A valid key corresponding to a saved diagram file in Local Storage
Returns a Promise that resolves with information about a diagram file saved to local storage
Get information about the currently logged in user. This information varies from subclass to subclass. For more info, see:
Returns a Promise that resolves with information about the currently logged in user
Hide the ui element associated with this instance of GoCloudStorage. Used in some UI element onclicks.
If action (save, delete, load) is canceled, resolve Promise (returned previously in showUI) with a 'Canceled' notification. Default value is false.
Get the contents of a given file; load to managedDiagrams model.
A valid localstorage key to load diagram model data from
Returns a Promise that resolves with a DiagramFile representing the loaded file
Get the contents of a given file; load to managedDiagrams model. Use the custom filepicker ui.
Returns a Promise that resolves with a DiagramFile representing the loaded file
Delete a given diagram from Local Storage.
A valid localstorage key to delete diagram model data from
Returns a Promise that resolves with a DiagramFile representing the deleted file
Delete a diagram from Local Storage using the custom filepicker menu ui.
Returns a Promise that resolves with a DiagramFile representing the deleted file
Save managedDiagrams' model data to Local Storage. If path is supplied save to that path. If no path is supplied but currentDiagramFile has non-null, valid properties, update saved diagram file content at the key in Local Storage corresponding to currentDiagramFile.path with current managedDiagrams' model data. If no path is supplied and currentDiagramFile is null or has null properties, this calls saveWithUI.
A string to save diagram model data to (becomes the key for the file in Local Storage)
Returns a Promise that resolves with a DiagramFile representing the saved file
Save the current managedDiagrams's model data to Local Storage using the custom filepicker ui.
Returns a Promise that resolves with a DiagramFile representing the saved file
Show the custom Go Local Storage filepicker ui.
Clarify what action is being done after file selection. Must be one of the following:
Optional: Number of files to show in UI, in addition to a static numerical property (that can only be modified by changing source code). This prevents long wait times while the UI loads if there are a large number of diagram files stored in Local Storage.
Returns a Promise that resolves (in save, load, or remove with an DiagramFile representing the saved/loaded/deleted file
Class for saving / loading Diagram models to / from Local Storage. GoLocalStorage is the only GoCloudStorage subclass than can be used in a local page; that is, one not served by a web server.
Note: that this class will not work with browsers that do not have Local Storage support (like some old versions of Internet Explorer).