The packageName variable is where you can inject your own custom code to be executed before or after the stealJS conversion. For example, you can check if the packageName variable has the word “steal” in it and do some custom post-conversion work. In the example below, the packageName variable is checked and if it has the word “steal” in it, the customSteal function is called.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 // stealJS conversion var stealConverter = new stealConverter ( 'some-package-name' , { packageName : function ( ) { if ( this . name === 'steal' ) { // customSteal } } }); // stealJS conversion var stealConverter = new

stealJS Options

The stealJS function has a set of options that can be used to customize the conversion process.
Here are a few examples of how these options could be used:

StealJS Object

The stealJS object is where you define the conversion you want to run on your page. For example, you can convert a row into an Object in the below code:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 // stealJS conversion var stealConverter = new stealConverter ( 'some-package-name' , { packageName : function ( ) { if ( this . name === 'steal' ) { // customSteal } } }); // Customize a row var row = document . getElementByID ( "row" ); var myRowObject = new Object (); for ( var i = 0 ; i

The stealJS Convenience API

The stealJS convenience API enables you to make customizations to a stealJS conversion. The most common customization is to execute custom code before or after a conversion.
It also allows you to customize the packageName variable to inject your own code into the process.
Customizing the packageName variable is done by specifying a function that accepts two parameters: an object with all of the packages you want to be able to run and then the name of the package.

Timeline

Published on: 09/16/2022 22:15:00 UTC
Last modified on: 09/21/2022 15:34:00 UTC

References