Page 1 of 1

Javascript editor

Posted: Sat Jul 19, 2014 12:08 am
by Beej

I'm pretty happy with Appery's javascript editor, but have two questions.

  1. The code checker does not seem to like strict mode. Can't even use the Appery function:

    Image

    Do you recommend not using javascript strict?

  2. Is there a way to make the text indent two spaces instead of four (so I can see more horizontally)?


Javascript editor

Posted: Sat Jul 19, 2014 3:07 am
by Illya Stepanov

Hello -

  1. Where do you use this code? I can't reproduce it.
  2. This is a standard indentation and you can't customise it.

Javascript editor

Posted: Sat Jul 19, 2014 3:33 am
by Beej

Sorry, warnings arise when strict is declared inside any function:

prefunction PrintMsg(type) {
'use strict';
if (type == 'error') {
Appery('lbl_msg').css('color', '#f55353');
} else {
Appery('lbl_msg').css('color', '#53f594');
}
}
/pre

Looks like the answer for now is to always use the function form, no matter where it's declared:

pre(function () {
'use strict';
}());
/pre


Javascript editor

Posted: Mon Jul 21, 2014 12:05 am
by Yurii Orishchuk

Hi Beej,

That's not a problem,

you can use

pre

self.Appery('lbl_msg').css('color', '#f55353');

/pre

instead of

pre

Appery('lbl_msg').css('color', '#f55353');

/pre

Regards.


Javascript editor

Posted: Mon Jul 21, 2014 12:29 am
by Beej

OK, got it, thanks.