How to make a globally accessible variable?

前端 未结 6 2059
难免孤独
难免孤独 2021-01-11 18:22

How can I make a globally accessible variable in nightwatch.js? I\'m using a variable to store a customized url (dependent on which store is loaded in our online product), b

6条回答
  •  青春惊慌失措
    2021-01-11 18:48

    generaly it is a bad practice, but you can assign it as field of window class.

    window.someGlobalVar = 'http://example.org/'
    

    and window object is accessible globally

提交回复
热议问题