hhzl / amber-snapsvg-demo Goto Github PK
View Code? Open in Web Editor NEWDemo of Amber Smalltalk using the snap.svg graphical library
License: MIT License
Demo of Amber Smalltalk using the snap.svg graphical library
License: MIT License
The code in this repo works fine for Amber v0.14.1
However if I do
git clone https://github.com/hhzl/Amber-snapsvg-demo.git
cd Amber-snapsvg-demo
npm install
bower install
grunt devel
no longer works.
Reason
A newer version of Amber is loaded. This probably causes the problem.
As #3 (upgrade to 0.14.3) causes problems let's first upgrade to version 0.14.2 (fixed version number).
Add deployment instructions to the README.md
Before
| s snapLib bigCircle smallCircle |
snapLib := require value: 'snap.svg'.
s := snapLib value: 300 value: 600.
After
doSnapSvg
"translation to Smalltalk points 1 to 4 of http://snapsvg.io/start/ "
| s bigCircle smallCircle |
s := snapSvg value: 300 value: 600.
Herby writes on ML:
Update you amber pieces:
Globally:
npm -g install amber-cli
Per project:
bower install
npm update
In 0.14.4, finally import feature works in compiler as well, not just in the core. In Helios, you can see this line in any package template:
imports: {}
The '{}' is just a plain dynamic array. Here you specify, which external modules your package depends upon. Let's say you need snap.svg and bootstrap and they are known via names 'snag.svg' and 'bootstrap' in *.amd.json files. You put there
imports: {'snapSvg' -> 'snap.svg'. 'bootstrap'}
You then must commit the package and reload to take effect.
When you put just strings in imports (like 'bootstrap'), the module is just loaded as a package dependency. If you put association there (like 'snapSvg' -> 'snap.svg'), you also define a variable where to import the dependency. In that case, any method within a package can freely use variable 'snapSvg' which will contain anything what 'snap.svg' module exports. If you use that variable outside the package, you get a compile error, of course - the variable is only known within a package.
That said - jQuery was listed among the 'allowed to compile everywhere' exceptions along with window, document, process and global. It is now deprecated (already deleted in master) and will be removed in 0.14.5 or 0.15.0, whichever comes first. Web is the only package that uses jQuery. Try to reuse its #asJQuery to wrap objects and 'PlatformInterface ajax:' to call ajax API. If you absolutely need it, just do what Web package did:
imports: {'jQuery' -> 'jquery'}
Update the README for Amber 0.14.4.
The instructions say that
'snap.svg',
should be added manually to deploy.js
. This should not be done for 0.14.4.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.