Thanks to visit codestin.com
Credit goes to github.com

Skip to content

'use strict' and var shine = shine || {}; #42

@bmcbarron

Description

@bmcbarron

Howdy! I'm enjoying moonshine, thank you!

I see that several files use the idiom:

'use strict'
var shine = shine || {};

In Chrome, this results in:

var shine;           // implicitly undefined
shine = shine || {}; // ... therefore always {}

Thus, you can't use this technique to augment the same object (e.g. including moonshine.js and distillery.moonshine.js together).

This is further confused because in moonshine.js, 'use strict' is not the first line of code, so it actually has no effect. Things sometimes work as intended, depending on the exact mechanism used to include those two files.

I verified two possible ways of fixing this:

  1. Remove 'use strict'.
  2. Use var shine = this.shine = this.shine || {};

If you pursue the second case, I recommend moving 'use strict'; to the top of moonshine.js, to get the intended effect.

Cheers, and thanks again!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions