Scrawl-canvas v8 - Component test 003

Save and load Scrawl-canvas entity using text packets

Test purpose

  1. Create a block entity - including functionality to react to mouse enter/leave movements and an anchor which is triggered following a mouse click on the block
  2. Create text packets of the block, using various arguments for the block's saveAsPacket() function
  3. Delete the block (using the block.deregister() function)
  4. Attempt to recreate the block from one of the text packets previously saved
  5. Attempt to update the reconstituted block using a packet file downloaded from the server
  6. Attempt to update the block using a second packet file which includes an instruction to remove the block's anchor functionality.

Note: step 3 starts within a second of the demo loading; step 5 takes place 5 seconds into the demo; step 6 happens a further 5 seconds later. Results of the tests will print out in the browser's console.

Annotated code