issue when expose arrive API to window
giannoudak opened this issue · 6 comments
hi, and thanks for your wrapper library over Mutation Observers
we use arrive.js in one site, and when trying to expose the arrive API in window, we get the error bellow:
// the call in arrive.js line 441:
exposeApi(window.prototype);
// the error:
Uncaught TypeError: Cannot set property 'arrive' of undefined
at Object.exposeApi (arrive.js:427)
at eval (eval at <anonymous> (arrive.js:440), <anonymous>:1:1)
at arrive.js:440
at Object.r.1 (arrive.js:449)
it seems that the window.prototype is undefined. why this may happen? Is there any way to override this property of window object?
is there any workaround on this? maybe using Window.proto instead will fix it?
@giannoudak is it specific to some browser. If so, let me know the browser name & version. Also, is your site live, can I check it?
@uzairfarooq It isn't for a specific browser. I tried both in chrome and Firefox and the problem is same.
You could check this issue at the homepage of the site below.
http://www.happyparenting.gr/
Let me know your thoughts.
hi @uzairfarooq did you manage to check fo this?
thanks in adavance
Yeah, I had a look into it but not sure what's causing window.prototype
to be null, could be some other library. As a workaround you can remove exposeApi(Window.prototype);
from the lib.
Will try to have a detailed look when I have some time.
Window
is not defined in PhantomJS (prebuilt, 2.1.14) (running under Karma (0.13.22)).
We should consider using globalThis (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis) in arrive with appropriate fallbacks.