behavior3 / behavior3js

Behavior3 client library for Javascript (Behavior Trees for Javascript)
MIT License
402 stars 105 forks source link

Usage in node.js produces error unless I define b3 in the global namespace first #4

Closed chrisl8 closed 7 years ago

chrisl8 commented 9 years ago

I am using behaviro3js in node.js, and it works, except that I have to declare an empty b3 object in the global scope first.

This works:

b3 = {}
var behavior3js = require('behavior3js');

However, if I just do this:

var behavior3js = require('behavior3js');

without the "b3" declaration I receive this error:

_filename, __dirname) { this.b3=this.b3||{},function(){"use strict";b3.VERSION
                                                                    ^
ReferenceError: b3 is not defined

renatopp commented 9 years ago

There are some pending updates on b3js, I hope to fix that together.

elicwhite commented 8 years ago

+1

chrisl8 commented 7 years ago

This is fixed with the new updates introduced by @danielepolencic