1

I create a NativeScript plugin. I would like the plugin to be instantiated when it is imported. Is it possible ? If I think badly, is there another way?

// A message should appear in the console
import * example from "example";

// The message appears in the console because the plugin is imported
bgrand-ch
  • 788
  • 1
  • 7
  • 19
  • 1
    That depends on what your plugin does. For example, you could take a look at nativescript-platform-css / nativescript-orientation plugins, those does the job upon import statement, they actually do not need an instance. You could design your plugin as a singleton. – Manoj Oct 21 '19 at 17:45
  • Thank you very much @Manoj ! Import the plugin with the event of the launched application works perfectly well. – bgrand-ch Oct 22 '19 at 16:17

0 Answers0