Opened 8 years ago

Closed 8 years ago

#13217 closed defect (fixed)

demos not finding previously global symbols

Reported by: bill Owned by: bill
Priority: high Milestone: 1.7
Component: BuildSystem Version: 1.7.0b1
Keywords: Cc:
Blocked By: Blocking:

Description

I'm not sure if this is a bug in the builder, or more likely a limitation that should be documented as it's apparently a behavioral change from 1.6.

demos/mail/src.js has:

var fakeReport = function(percent){
	// FIXME: can't set a label on an indeterminate progress bar
	// like if(this.indeterminate) { return " connecting."; }
	return dojo.string.substitute("Fetching: ${0} of ${1} messages.", [percent * this.maximum, this.maximum]);
}

This code essentially needs to create fakeReport as a global variable, so that it can be accessed from:

<div id="fakeFetch" dojoType="dijit.ProgressBar" ...
     report="fakeReport"></div>

However, after running the build:

./build.sh copyTests=true mini=false action=clean,release profile=demos-all cssOptimize=comments.keepLines cssImportIgnore=../dijit.css

The function becomes inaccessible because it's encased in:

define([...], function(dojo, dijit, dojox){
   ...
}

What do you think?

Note that function definitions like:

function foo(){
}

will also become inaccessible. The only way to make "globals" is:

foo = function(){
}

Change History (7)

comment:1 Changed 8 years ago by Rawld Gill

Status: newassigned

I tend to think of this as a feature rather than an error.

You could use dojo.global which seems a little cleaner than using an undefined global var directly. For example, I tried adding the following line after the function definition (of course you could just assign the function def to dojo.global.fakeReport directly):

dojo.global.fakeReport = fakeReport;

I built as prescribed in the summary and the app seemed to load correctly (I verified the problem before the proposed repair).

comment:2 Changed 8 years ago by bill

Summary: built mail demo fails not finding fakeReportbuilt demos not finding previously global symbols

OK, just please document this feature in the release notes, as it will break existing code.

The flashCards, touch, uploader, and video demos also look broken (judging from reading src.js, not from testing).

comment:3 Changed 8 years ago by bill

Owner: changed from Rawld Gill to bill
Status: assignednew

Actually, I'll fix this and start on the release notes (unless you really want to).

comment:4 Changed 8 years ago by bill

Summary: built demos not finding previously global symbolsdemos not finding previously global symbols

Note that at least for the flashCards demo, the problem isn't isolated to builds, it happens on source too.

comment:5 Changed 8 years ago by bill

(In [25622]) fix global variable problem for flashCards demo, refs #13217 !strcit

comment:6 Changed 8 years ago by bill

(In [25624]) fix global variable problem for mail demo, refs #13217 !strcit

comment:7 Changed 8 years ago by bill

Resolution: fixed
Status: newclosed

(In [25627]) fix global variable problem for uploader demo, plus removing apparently unused function, refs #13217 !strict

I think that's the last one. Lots of demos are still broken but apparently for other reasons.

Note: See TracTickets for help on using tickets.