Put a frying pan on medium heat, and add oil. When the oil is hot, add sliced onions, salt, and star anise.
Stir from time to time. If they start to get too brown, turn down the heat a little. (You want a 'caramelized' brown, not a 'burnt' brown.)
Once they start to get translucent, give them a stir and then leave them alone for about 10 minutes.
Then stir them gently. They should be releasing their liquid, and starting to caramelize and sweeten. Every 3 minutes or so, go back and stir them. Once they've reached the color (and flavor) you want, take them off the heat. Let them cool to room temperature. When cool, put in a covered container and place in the refrigerator. They will keep for a week.
Notes:
These onions make a wonderful topper to steak, seafood, burgers, or chicken. You can also toss with pasta and whatever vegetables, cooked meats, or cheeses you have in your refrigerator. Add them to sautéed vegetables during the last minute of cooking.