Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No function named onOpenDocument in Sketch Panel UI Framework #5

Open
eldos-dl opened this issue Jul 25, 2017 · 0 comments
Open

No function named onOpenDocument in Sketch Panel UI Framework #5

eldos-dl opened this issue Jul 25, 2017 · 0 comments

Comments

@eldos-dl
Copy link

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);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant