Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strict mode error when using on-load #411

Open
callil opened this issue Feb 5, 2018 · 3 comments
Open

Strict mode error when using on-load #411

callil opened this issue Feb 5, 2018 · 3 comments

Comments

@callil
Copy link

callil commented Feb 5, 2018

Hi folks, I know this issue has been discussed before but I'm still getting issues when attempting to use the on-load library with create-choo-app that's using the latest bankai build.

onload(div, (el) => { console.log('Loaded') }, (el) => { console.log('Unloaded')

results in:

Uncaught TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them

I can solve this by switching to budo or (according to another test someone did) by disabling babelify. However, it seems like something that should work out of the box.

full gist here: https://gist.github.com/callil/52db52b6786d053a84ad8190a46058d8

@YerkoPalma
Copy link
Member

To avoid this error in strict mode, you should apply the yo-yoify transform

@callil
Copy link
Author

callil commented Feb 5, 2018

ok I will give that a shot - also a solution here I missed: shama/on-load#15

  const uniqueIdentifier = 1
    onload(div, (el) => {
    console.log('Loaded')
  }, (el) => {
    console.log('Unloaded')
  }, uniqueIdentifier)

@goto-bus-stop
Copy link
Member

I think using yoyoify no longer helps because choo doesn't support onload attributes in template tags anymore. The identifier solution should probably be documented in the onload readme

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants