I am creating a custom module for Polymer. I need to create a global variable that can be accessed when defining a template. Something like:
<template is="dom-if" if="[[_check(myGlobalVar.foo)]]">
The global variable should also be directly accessible from inside the module (see _anotherFunction) . The JS file looks like:
Polymer({
is: 'my-module',
_check(f) {
return f == 'foobar'
},
_anotherFunction() {
console.log(myGlobalVar)
}
})
In addition, myGlobalVar should be accessible from other modules in other files. What's the best way to create it?