jeremyckahn / shifty

The fastest TypeScript animation engine on the web
https://jeremyckahn.github.io/shifty/doc/
MIT License
1.54k stars 88 forks source link

root is empty when using browserify #54

Closed alexkirsz closed 9 years ago

alexkirsz commented 9 years ago

When requiring shifty via browserify, the root object is set as an empty object. When Tweenable.prototype.stop is called, shifty throws

Uncaught TypeError: undefined is not a function     shifty.js:397
Tweenable.stop                                      shifty.js:397
timeoutHandler                                      shifty.js:186_timeoutHandler
jeremyckahn commented 9 years ago

Hi @Morhaus, thanks for reporting this. I haven't used Browserify, so I'm not familiar with the workflow. Can you provide some steps to reproduce this issue?

alexkirsz commented 9 years ago
mkdir shifty-browserify-example
cd shifty-browserify-example
sudo npm install -g browserify
npm install shifty

In shifty-browserify-example/index.js

var Tweenable = require('shifty');

var tweenable = new Tweenable();

tweenable.tween({
  from: { x: 0,  y: 50  },
  to:   { x: 10, y: -30 },
  duration: 1500,
  easing: 'easeOutQuad',
  start: function () { console.log('Off I go!'); },
  finish: function () { console.log('And I\'m done!'); }
});
browserify index.js > browserified.js

Then simply include shifty-browserify-example/browserified.js in a page and you should see the error.

jeremyckahn commented 9 years ago

Cool, thanks for the info. I will debug this when I have some time, hopefully later today.

jeremyckahn commented 9 years ago

This should be fixed in 1.3.5, let me know how it goes. Thanks again for reporting this!

alexkirsz commented 9 years ago

No more issues for me :) Thanks!