From b7e24274f97c73fd79bbe992f6e946b14207acce Mon Sep 17 00:00:00 2001 From: themitosan Date: Wed, 27 Sep 2023 09:12:52 -0300 Subject: [PATCH] Add context example on readme --- README.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0b910d5..9c8587b 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ build_status -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! @@ -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: +// 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); + + ## External scripts / plugins used on this project: - [uglify-js](https://www.npmjs.com/package/uglify-js)