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

Unexpected token import #69

Closed
lemonbuzz opened this issue Jun 9, 2016 · 3 comments
Closed

Unexpected token import #69

lemonbuzz opened this issue Jun 9, 2016 · 3 comments

Comments

@lemonbuzz
Copy link

lemonbuzz commented Jun 9, 2016

I am trying to use this plugin..But it throws me this error in the console:

"Uncaught SyntaxError: Unexpected token import" @ line 2 in Timer.js

I don't know whats wrong...

I don't have a very specific or different working tree...

Project/
├── action
│   ├── CommonAction.php
│   ├── DAO
│   │   ├── Connection.php
│   │   ├── dbInfo.php
│   │   └── UserDAO.php
│   └── IndexAction.php
├── index.php
├── js
│   ├── constants.js
│   ├── index.js
│   ├── Timer.js
│   ├── util.js
│   └── utils.js
└── stylesheets
└── style.css

Some help would be cool :D

@walmik
Copy link
Owner

walmik commented Jun 9, 2016

Hi @lemonbuzz I think you are referencing the ES6 class directly. Please use the transpiled timer.jquery.js or timer.jquery.min.js from the dist/ folder in this repo. Please let me know if that helps and thanks for using this plugin!

Here is a link in case you wanna take it directly from there:
https://raw.githubusercontent.com/walmik/timer.jquery/master/dist/timer.jquery.min.js

Download and save that in your js/ folder (remove all the other files there like Timer, constants, utils)

@lemonbuzz
Copy link
Author

Works!!! Thank you very much for the fast response!

Honestly when i saw the code i was a bit perplexed as I never saw classes like that in JS..only encountered the prototype based "classes"...Mind to explain this? What is the ES6 class?

@walmik
Copy link
Owner

walmik commented Jun 10, 2016

Glad it worked out :)

You are not too far when you say 'prototype based "classes". The 'class' you see in this repo is kinda the same thing. Classes are introduced in ECMAScript 6 and are syntactical sugar over JavaScript's existing prototype-based inheritance.

You can read more here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes

@walmik walmik closed this as completed Jun 10, 2016
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

2 participants