Tuesday, July 2, 2013

New Beta to Test Dart FF Fix

‹prev | My Chain | next›

After a bit of detective work last night, with a #pairwithme assist from Jon Kirkman, I found that the Firefox load issue in the Dart version of the ICE Code Editor is a timing issue.

Last night we found that we could ensure that the preview layer would load if we delayed the preview layer by 1000 milliseconds:
class Editor {
  // ...
  updatePreview() {
    if (this.edit_only) return;

    var iframe = this.createPreviewIframe();

    var wait = new Duration(milliseconds: 1000);
    new Timer(wait, (){
      if (iframe.contentWindow == null) return;
      // Do iframe-y stuff here...
  // ...
Obviously that is not much of a long term solution—3D Game Programming for Kids programmers should not have to wait any longer than necessary for preview updates.

Might it be sufficient to listen to the onLoad stream? I give it a try, replacing the timer:
class Editor {
  // ...
    if (this.edit_only) return;


    var iframe = this.createPreviewIframe();
    iframe.onLoad.listen((_) {
      if (iframe.contentWindow == null) return;
      // Do iframe-y stuff here...
  // ...
And that seems to do it. At least locally. There is still the nagging issue of ensuring that it works in application in production. But first…

I have been messing around with the new GitHub release feature today. I am hopeful that it will encourage me to produce useful release notes. So far I have:

One thing that I have to figure out is the difference between the title and the tag. For now, I tag with the semantic version (v0.0.6) and title with something a little more meaningful if it makes sense (0.1-beta1). The semantic version corresponds to version in my pubspec.yaml—the version that will be used for packaging on Dart Pub.

To try my fix out in its ultimate destination, appcache in http://gamingjs.com/ice-beta, I need to publish to pub, then install it on the gamingjs.com site. So I start by updating ICE's pubspec.yaml:
name: ice_code_editor
version: 0.0.7
Then I pub lish my package to Dart Pub, then pub update the gamingjs site:
➜  ice-beta git:(gh-pages) ✗ pub update
Resolving dependencies..........
Downloading ice_code_editor 0.0.7 from hosted...
Dependencies updated!
Dart pub still does not work well with static sites like GitHub pages, so I am forced to manually remove the symbolic links and replace them with actual copies:
➜  ice-beta git:(gh-pages) ✗ cd packages
➜  packages git:(gh-pages) ✗ ls -l
total 24
lrwxrwxrwx 1 chris chris 65 Jul  2 23:58 browser -> /home/chris/.pub-cache/hosted/pub.dartlang.org/browser-0.5.20/lib
lrwxrwxrwx 1 chris chris 64 Jul  2 23:58 crypto -> /home/chris/.pub-cache/hosted/pub.dartlang.org/crypto-0.5.20/lib
lrwxrwxrwx 1 chris chris 72 Jul  2 23:58 ice_code_editor -> /home/chris/.pub-cache/hosted/pub.dartlang.org/ice_code_editor-0.0.7/lib
lrwxrwxrwx 1 chris chris 60 Jul  2 23:58 js -> /home/chris/.pub-cache/hosted/pub.dartlang.org/js-0.0.22/lib
lrwxrwxrwx 1 chris chris 62 Jul  2 23:58 meta -> /home/chris/.pub-cache/hosted/pub.dartlang.org/meta-0.5.20/lib
lrwxrwxrwx 1 chris chris 66 Jul  2 23:58 unittest -> /home/chris/.pub-cache/hosted/pub.dartlang.org/unittest-0.5.20/lib
➜  packages git:(gh-pages) ✗ rm *
➜  packages git:(gh-pages) ✗ cp -r /home/chris/.pub-cache/hosted/pub.dartlang.org/browser-0.5.20/lib browser
➜  packages git:(gh-pages) ✗ cp -r /home/chris/.pub-cache/hosted/pub.dartlang.org/crypto-0.5.20/lib crypto
➜  packages git:(gh-pages) ✗ cp -r /home/chris/.pub-cache/hosted/pub.dartlang.org/ice_code_editor-0.0.7/lib ice_code_editor
➜  packages git:(gh-pages) ✗ cp -r /home/chris/.pub-cache/hosted/pub.dartlang.org/js-0.0.22/lib js
➜  packages git:(gh-pages) ✗ cp -r /home/chris/.pub-cache/hosted/pub.dartlang.org/meta-0.5.20/lib meta
➜  packages git:(gh-pages) ✗ cp -r /home/chris/.pub-cache/hosted/pub.dartlang.org/unittest-0.5.20/lib unittest
With that, I am ready to compile my Dart into JavaScript:
➜  packages git:(gh-pages) ✗ cd ..
➜  ice-beta git:(gh-pages) ✗ dart2js  -omain.dart.js main.dart
And then push my changes to the GitHub repository:
➜  ice-beta git:(gh-pages) ✗ git ci -m "Bump ICE beta to pick up FF fix attempt" -a
➜  ice-beta git:(gh-pages) ✗ gp origin gh-pages
Finally, I load it up in Firefox and voilà! It works:

The preview show when the page loads and all is well. So last, but not least, I document this new release on GitHub:

And call it a day there.

At some point I need to decide if subsequent betas should get their own releases or if new line items should just go into an existing beta release. That's something for another day—as in after I actually reach 0.1 and releases take on more importance. For now, I am excited that release notes seem so do-able without severely impacting my existing workflow.

Day #800

No comments:

Post a Comment