Skip to content

Commit 807cbb6

Browse files
committed
Added a method to return the Dojo toolkit version.
See `aboutDojo()`.
1 parent 16eeeaa commit 807cbb6

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ For additional information, see Iliya Romm's guest Undocumented Matlab article,
88
[`fontWeight`](#fontWeight) - Modify font weight
99
[`fontColor`](#fontColor) - Modify font folor
1010
[`setStyle`](#setStyle) - Modify a specified style property
11+
`aboutDojo` - Return version information about the Dojo toolkit.
1112

1213
<a name="textAlign"></a>
1314
#### *mlapptools*.**textAlign**(*uielement*, *alignment*)

mlapptools.m

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
% fontColor - utility method for modifying font color.
99
% setStyle - utility method for modifying styles that do not (yet) have a
1010
% dedicated mutator.
11+
% aboutDojo - returns version information about the Dojo toolkit.
1112

1213
properties (Access = private, Constant = true)
1314
QUERY_TIMEOUT = 5; % Dojo query timeout period, seconds
@@ -65,8 +66,26 @@ function fontColor(uielement, newcolor)
6566
rethrow(ME);
6667
end
6768
end
69+
function [dojoVersion] = aboutDojo()
70+
if ~numel(matlab.internal.webwindowmanager.instance.findAllWebwindows())
71+
f=uifigure; drawnow; tmpWindowCreated = true;
72+
else
73+
tmpWindowCreated = false;
74+
end
75+
76+
dojoVersion = matlab.internal.webwindowmanager.instance ...
77+
.windowList(1).executeJS('dojo.version');
6878

69-
end % Public static methods
79+
if tmpWindowCreated
80+
delete(f);
81+
end
82+
% If MATLAB is sufficiently new, convert the JSON to a struct:
83+
if str2double(subsref(ver('matlab'), substruct('.','Version'))) >= 9.1 %R2016b
84+
dojoVersion = jsondecode(dojoVersion);
85+
end
86+
end % aboutDojo
87+
88+
end % Public Static Methods
7089

7190
methods (Static = true, Access = private)
7291
function [win] = getWebWindow(uifigurewindow)

0 commit comments

Comments
 (0)