3 ms·
Some libraries (fb, ga) using a single factory method that handles all commands. Ex: fb('init', {}) The others (segment, heap) use explicit functions for diff
by CaveTech 9y ago
Some libraries (fb, ga) using a single factory method that handles all commands.
Ex: fb('init', {})
The others (segment, heap) use explicit functions for different actions.
Ex: heap.init()
The main benefit is you can detect API violations without loading the async script. If you call an invalid function with the former you have to wait for it to execute at some point in the future.
This allows you to surface errors immediately - breaking current exection - even if it's additional libraries havent loaded.