-
Notifications
You must be signed in to change notification settings - Fork 58
Usage with AMD
Ingvar Stepanyan edited this page Sep 12, 2013
·
5 revisions
jBinary
supports dynamic loading via AMD too:
// somewhere in config:
require.config({
paths: {
jdataview: '//jdataview.github.io/dist/jdataview.js', // if skipped,
// will try to look for jdataview.js in the same directory and, when not found, to load it from CDN
jbinary: '//jdataview.github.io/dist/jbinary.js',
}
});
// ...
// in code:
require(['jbinary'], function (jBinary) {
var typeSet = {
magic: ['array', 'uint8', 4]
};
jBinary.load('file.bin', typeSet, function (err, binary) {
console.log(binary.read('magic'));
});
});