Thursday, 11 May 2017

ReferenceError: self is not defined

When i try to run my javascript (firebase.js taken from https://firebase.google.com/docs/web/setup) in nodejs i have the error ReferenceError: self is not defined :

C:\Program Files\nodejs>node.exe c:\Temp\firebase.js
c:\Temp\firebase.js:535
I.prototype.onTokenRefresh=function(){throw this.a.create("only-available-in-window");};I.prototype.onTokenRefresh=I.prototype.onTokenRefresh;I.prototype.setBac
kgroundMessageHandler=function(){throw this.a.create("only-available-in-sw");};I.prototype.setBackgroundMessageHandler=I.prototype.setBackgroundMessageHandler;I
.prototype.delete=function(){D(this.c)};var J=function(a,b){var c={};return c["firebase-messaging-msg-type"]=a,c["firebase-messaging-msg-data"]=b,c};var K=self,
P=function(a){I.call(this,a);var b=this;this.a=new firebase.INTERNAL.ErrorFactory("messaging","Messaging",x);K.addEventListener("push",function(a){return L(b,a)
},!1);K.addEventListener("pushsubscriptionchange",function(a){return N(b,a)},!1);K.addEventListener("notificationclick",function(a){return O(b,a)},!1);this.b=nu
ll};f(P,I);



ReferenceError: self is not defined
    at Object.<anonymous> (c:\Temp\firebase.js:535:476)
    at Object.<anonymous> (c:\Temp\firebase.js:547:800)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.runMain (module.js:605:10)
    at run (bootstrap_node.js:427:7)
    at startup (bootstrap_node.js:151:9)

any ideas what i can do to avoid it ?



via Henry

No comments:

Post a Comment