In the default code generated by Sketch Panel UI Framework, there is no onOpenDocument function in Panel/Panel.js while we have default onStartup and onSelectionChanged functions.
"handlers" : {
"actions" : {
"Startup" : "onStartup",
"OpenDocument":"onOpenDocument",
"SelectionChanged.finish" : "onSelectionChanged"
}
}
}
]
*/
var onStartup = function(context) {
var testing_FrameworkPath = testing_FrameworkPath || COScript.currentCOScript().env().scriptURL.path().stringByDeletingLastPathComponent().stringByDeletingLastPathComponent();
var testing_Log = testing_Log || log;
(function() {
var mocha = Mocha.sharedRuntime();
var frameworkName = "testing";
var directory = testing_FrameworkPath;
if (mocha.valueForKey(frameworkName)) {
testing_Log("😎 loadFramework: `" + frameworkName + "` already loaded.");
return true;
} else if ([mocha loadFrameworkWithName:frameworkName inDirectory:directory]) {
testing_Log("✅ loadFramework: `" + frameworkName + "` success!");
mocha.setValue_forKey_(true, frameworkName);
return true;
} else {
testing_Log("❌ loadFramework: `" + frameworkName + "` failed!: " + directory + ". Please define testing_FrameworkPath if you're trying to @import in a custom plugin");
return false;
}
})();
};
var onSelectionChanged = function(context) {
testing.onSelectionChanged(context);
};
In the default code generated by Sketch Panel UI Framework, there is no
onOpenDocument
function in Panel/Panel.js while we have defaultonStartup
andonSelectionChanged
functions.