Skip to content

Commit

Permalink
Add context example on readme
Browse files Browse the repository at this point in the history
  • Loading branch information
themitosan committed Sep 27, 2023
1 parent ee23b82 commit b7e2427
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<img src="https://img.shields.io/github/actions/workflow/status/themitosan/TMS.js/main.yaml" alt="build_status">
</h1>

Created by [themitosan](https://themitosan.github.io/), this is a simple plugin for managing css and HTML stuff ___without jQuery___.
Created by [TheMitoSan](https://themitosan.github.io/), this is a simple plugin for managing css and HTML stuff ___without jQuery___.

## Setup
[TS] - It's deadly simple!
Expand All @@ -31,6 +31,22 @@ Example: ```TMS.addClass('myDiv', 'fixWidth');```
### TMS.removeClass(domId, className)
Example: ```TMS.removeClass('myDiv', 'fixWidth');```

**INFO**: You can also _provide other contexts_ for all available functions. This allows you to manipulate data from another opened windows (like `nw.js` Window.open function).

Example: <code>
// Import module and create context variable
import * as TMS from './TMS';
var context;

// Open window
nw.Window.open('project/somePage.html', {}, function(data:any){
context = data.window.document;
});

// Set div CSS data from new opened window by providing context
TMS.css('someDivInsideNewWindow', { 'width': '100%', height: '20px' }, context);
</code>

## External scripts / plugins used on this project:
- [uglify-js](https://www.npmjs.com/package/uglify-js)

Expand Down

0 comments on commit b7e2427

Please sign in to comment.