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

Script caching issue #889

Closed
nickav opened this issue Jul 9, 2016 · 4 comments
Closed

Script caching issue #889

nickav opened this issue Jul 9, 2016 · 4 comments
Assignees

Comments

@nickav
Copy link

nickav commented Jul 9, 2016

Steps to reproduce:

  1. Create a new "Hello World" project
  2. Run the project in the simulator
  3. Edit text property in the file Script/HelloWorld.js and change it to something like "Hello, there!" instead of "Hello, world"
  4. Note that after refreshing the new text does not get rendered on the screen. The old "Hello, world!" text still persists.

Only after renaming the properties.text to something else (like test) then using this.test will the auto update grab the changes to the string.

The following is the output of the console:

Simulator : LOAD Js FILE: main.js
Simulator : Evaluating script/debugger/actors/script.js failed (evaluatedOK == JS_FALSE)
Simulator : /Applications/CocosCreator.app/Contents/Resources/cocos2d-x/simulator/mac/Simulator.app/Contents/Resources/script/debugger/actors/script.js:3139:ReferenceError: ObjectActor is not defined
Simulator : ScriptingCore::callFunctionName error:__errorHandler wasn't found!
Simulator : Cocos2d-JS v3.9
Simulator : iShow!

Mac OSX 10.9.5

@nickav nickav closed this as completed Jul 9, 2016
@nickav nickav reopened this Jul 9, 2016
@nickav
Copy link
Author

nickav commented Jul 9, 2016

I see now that the properties attribute of the Script just sets up the defaults. This should be made clearer with a comment above like: "defaults, override these from the Canvas"

@jareguo
Copy link
Contributor

jareguo commented Jul 9, 2016

This should be made clearer with a comment above like: "defaults, override these from the Canvas"

Hi, where should this comment display?

@nickav
Copy link
Author

nickav commented Jul 9, 2016

Not sure about the exact wording, but for example in assets/Script/HelloWorld.js:

cc.Class({
    extends: cc.Component,

    // defaults, set visually when attaching this script to the Canvas
    properties: {
        label: {
            default: null,
            type: cc.Label
        },
        text: 'Hello, world!'
    },

    // use this for initialization
    onLoad: function () {
        this.label.string = this.text;
    },

    // called every frame
    update: function (dt) {
    },
});

@jareguo
Copy link
Contributor

jareguo commented Jul 9, 2016

I think that's ok, thanks.
@knoxHuang Can you improve the comment in the HelloWorld project?

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

4 participants